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. 【Android】随时随地退出程序

    新建一个 ActivityCollector 类作为活动管理器,代码如下所示:public class ActivityCollector {public static List<Activit ...

  2. 【Android】isEmpty()

    对字符串进行非空判断,可以一次性进行两种空值的判断.当传入的字符串等于null或者等于空字符串的时候这个方法都会返回true,从而不需要单独去判断这两种空值,再利用逻辑运算符连接起来.

  3. centos7安装chrome的历程(fedora同)

    安装 首先是下载,地址奉上:http://www.google.cn/chrome/browser/desktop/index.html,选择64 bit .rpm (适用于 Fedora/openS ...

  4. Google C++ Style Guide在C++11普及后的变化

    转 http://www.cnblogs.com/chen3feng/p/5972967.html?from=timeline&isappinstalled=0&lwfrom=user ...

  5. Tran 与 Goto try catch raiserror等浅显应用

    ---- Tran 事务 以及 Goto 的浅显应用 IF OBJECT_ID('tempdb..#tmptab','U') IS NOT NULL DROP TABLE #tmptab GO CRE ...

  6. css - div垂直方向滚动

    只要设置 OVERFLOW-Y:auto;OVERFLOW-X:hidden即可.

  7. shell脚本学习之$0,$?,$!等的特殊用法

    变量说明: $$ Shell本身的PID(ProcessID) $! Shell最后运行的后台Process的PID $? 最后运行的命令的结束代码(返回值) $- 使用Set命令设定的Flag一览 ...

  8. Swift开源了,有什么好处?

    昨天swift开源了,喜大泪奔的好消息! swift的官方网站https://swift.org swift在github的开源地址https://github.com/apple/swift 今天早 ...

  9. matlab结构体形式保存数据生成.mat文件< 转>

    2015年 参加天池大数据竞赛     为了建立模型,打算基于matlab使用Random Forest Algorithm的工具包 该工具包我在此分享给大家,http://yunpan.cn/cVX ...

  10. Linux + C + Epoll实现高并发服务器(线程池 + 数据库连接池)(转)

    转自:http://blog.csdn.net/wuyuxing24/article/details/48758927 一, 背景 先说下我要实现的功能,server端一直在linux平台下面跑,当客 ...