LayoutInflater inflater = LayoutInflater(AudioActivity.this);
View timepickerview = inflater.inflate(R.layout.timepicker, null);

final Dialog loading = new Dialog(context, R.style.customstyle);//设置样式
loading.setCancelable(false);//点击屏幕不可消失
loading.show();//必须写在setContentView前面
int number = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, AudioActivity.this.getResources().getDisplayMetrics());
loading.setContentView(timepickerview,new RelativeLayout.LayoutParams(number*30, number*18));

Button positiveButton = (Button) timepickerview.findViewById(R.id.positiveButton);//确定按钮
Button negativeButton = (Button) timepickerview.findViewById(R.id.negativeButton);//取消按钮
positiveButton.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View v) {

}
});

xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/timePicker1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical" > <LinearLayout
android:id="@+id/wheelview"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight=""
android:orientation="horizontal" > <com.mogunote.time.WheelView
android:id="@+id/year"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="" /> <com.mogunote.time.WheelView
android:id="@+id/month"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="" /> <com.mogunote.time.WheelView
android:id="@+id/day"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="" /> <com.mogunote.time.WheelView
android:id="@+id/hour"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="" /> <com.mogunote.time.WheelView
android:id="@+id/min"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="" /> <com.mogunote.time.WheelView
android:id="@+id/sec"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="" />
</LinearLayout> <RelativeLayout
android:id="@+id/timePicker"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="@id/wheelview"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp" > <TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:text="@string/alarm"
android:textColor="@android:color/white"
android:textSize="18dip" /> <ToggleButton
android:id="@+id/toggle_AutoPlay"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/tv"
android:background="@drawable/btn_toggle"
android:gravity="left|center_vertical"
android:textOff=""
android:textOn="" />
</RelativeLayout> <View
android:layout_width="fill_parent"
android:layout_height="1px"
android:background="@color/gray"/> <LinearLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:orientation="horizontal" > <Button
android:id="@+id/positiveButton"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginTop="3dip"
android:text="确定"
android:background="@color/white"
android:textColor="@color/blue"
android:layout_weight=""
android:singleLine="true" />
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="@color/gray"
/>
<Button
android:id="@+id/negativeButton"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginTop="3dip"
android:text="取消"
android:background="@color/white"
android:textColor="@color/blue"
android:layout_weight=""
android:singleLine="true" />
</LinearLayout> </LinearLayout>

Android 自定义dialog(AlertDialog的修改样式)的更多相关文章

  1. Android自定义 Dialog 对话框

    Android自定义Dialoghttp://www.cnblogs.com/and_he/archive/2011/09/16/2178716.html Android使用自定义AlertDialo ...

  2. Android创建自定义dialog方法详解-样式去掉阴影效果

    在自定义组件时,从已有组件源码中会很大收获.就拿progressDialog来说     间接父类是dialog,想了解dialog继承结构可以去百度,或者    从构造器来说ProgressDial ...

  3. android 自定义Dialog背景透明及显示位置设置

    先贴一下显示效果图,仅作参考: 代码如下: 1.自定义Dialog public class SelectDialog extends AlertDialog{ public SelectDialog ...

  4. Android自定义Dialog

    Android开发过程中,常常会遇到一些需求场景——在界面上弹出一个弹框,对用户进行提醒并让用户进行某些选择性的操作, 如退出登录时的弹窗,让用户选择“退出”还是“取消”等操作. Android系统提 ...

  5. android 自定义Dialog去除黑色边框

    在自定义Dialog时显示的界面中老是有黑色的边框,下面就介绍使用style去除黑色边框方法. 首先在values/styles定义自定义样式: <style name="MyDial ...

  6. Android自定义Dialog及其布局

     实际项目开发中默认的Dialog样式无法满足需求,需要自定义Dialog及其布局,并响应布局中控件的事件. 上效果图: 自定义Dialog,LogoutDialog: 要将自定义布局传入构造函数中, ...

  7. Android—自定义Dialog

    在 Android 日常的开发中,Dialog 使用是比较广泛的.无论是提示一个提示语,还是确认信息,还是有一定交互的(弹出验证码,输入账号密码登录等等)对话框. 而我们去看一下原生的对话框,虽然随着 ...

  8. Android自定义Dialog(美化界面)

    前言:在做项目的时候,发现dialog界面太丑陋,从csdn上下载了一份自定义dialog的源码,在他的基础上对界面进行美化...有需要的朋友可以直接拿走 效果图如下: 主要代码: /** * 自定义 ...

  9. Android 自定义Dialog类,并在Activity中实现按钮监听。

      实际开发中,经常会用到Dialog,比如退出时候会弹出是否退出,或者还有一些编辑框也会用Dialog实现,效果图如下: 开发中遇到的问题无非在于如果在Activity中监听这个Dialog中实现的 ...

随机推荐

  1. sql查询最大id

    如 有个表里有字段 id,name,..... 当name是重复时取其id最大的一条记录 select max(id) id,name from 表 group by name --最小用mini - ...

  2. web前端:html

    一.理解表单的作用 1.web 应用程序不仅仅是给用户显示数据,还应该给用户提供一个可以输入数据的图形用户界面.表单的主要作用在于在网页上提供一个图形用户界面,已采集和提交用户输入的数据. 2.htm ...

  3. 使用Github建立个人博客

    总的说来 这个当有node.js 和gitbub的账号后,搭建一个自己的博客,想想还是挺美的事! 由于要把整个流程说清楚 估计lz还没这个实力,所以都是继承前辈们的经验,自己再添加一点遇到的问题和解决 ...

  4. jmeter中webdriver插件,进行自动化压测

    1.下载JMeterPlugins-WebDriver-1.1.2 2.将JMeterPlugins-WebDriver-1.1.2\lib\ext中的*.jar拷贝到D:\apache-jmeter ...

  5. SQL学习:查询的用法(1)

    在SQL servre的使用中,查询的用法是最多的.最重要的,也是最难学习的,因此掌握查询的用法很重要. 先将表的示例上图 员工表: 部门表:                             ...

  6. yieId浅谈

    例子:在不使用yieId时,通常我们都会采取先遍历再把元素加到新的List中 using (var reader = SqlHelper.ExecuteReader("")) { ...

  7. 非常的奇葩,终于解决了硬盘从盘盘符消失的问题 http://bbs.gamersky.com/thread-1712710-1-1.html (出处: 游民星空论坛)

    本人用电脑也十多年了,硬盘的问题也碰到过不少.但最近却碰到了一个很奇葩的问题.就是安装了一块全新的SSD硬盘当从盘,但在装上之后,在我的电脑中却不显示,没有盘符.不过打开系统磁盘管理却能显示硬盘信息. ...

  8. CSS 链接

    不同的链接可以有不同的样式. 链接样式 链接的样式,可以用任何CSS属性(如颜色,字体,背景等). 特别的链接,可以有不同的样式,这取决于他们是什么状态. 这四个链接状态是: a:link - 正常, ...

  9. angularjs服务常见用法

    服务可以再应用的整个生命周期内保持数据,不会在切换路由或者重新加载视图时被清楚掉(控制器只有在需要时才被实例化) 服务是一个单例对象,在每个应用中只会被实例化一次 服务在应用的生命周期内保存数据 an ...

  10. Git命令详解【2】

    git的工作区   git 安装 sudo apt-get insall git 查看git 版本 git --version   git的配置 #配置用户名 git config --global ...