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. WSDL阅读方法

    我们以天气预报WebService服务为例,来看看怎么阅读一个wsdl文档. 打开一个wsdl文档后,先看底部. binding在这里: portType在这里: 好了,看了上面的,我们来说说wsdl ...

  2. Android开发之意图解析

     android中意图(intent)就是告诉系统要做某件事情.比如要拨打电话或者发送短信. 或者在一个Activity中点击按钮跳转到另外一个activity时也用到意图.意图分为两种:显示意图和隐 ...

  3. Java基础知识强化之集合框架笔记58:Map集合之LinkedHashMap类的概述

    1. LinkedHashMap类的概述 LinkedHashMap:Map接口的哈希表(保证唯一性) 和 链接(保证有序性)列表实现,具有可预知的迭代顺序. 2. 代码示例: package cn. ...

  4. grep参数说明及常用用法

    grep参数说明及常用用法 趁着午休的时间把自己经常使用的一些grep命令整理一下. 方便以后查看. 后续会逐步把awk/sed/find等常用的命令理一理. 增强下记忆. 也算是对得起自己了. ^^ ...

  5. JavaScript单例模式

    一.什么是单例 意思是指获取的对象只有一份. 二.最通用的单例 任何时刻获取SingLeton.instance都是同一个对象 var SingLeton={ instance:{ property: ...

  6. javascript的面向对象编程

    面象对象编程技术的核心理念:封装.继承.多态:在一些主流的高级编程语言中,比如:C#,VB.NET,JAVA,PHP等都是很容易实现的,而如果要在javascript中实现面象对象编程,可就不那么直接 ...

  7. order by跟group by 跟having----------------sum() 求和   avg()求平均   count() 求个数--------------like

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoEAAACdCAIAAABEujUmAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWX ...

  8. [DEncrypt] C# DEncrypt加密/解密帮助类(转载)

    点击下载 DEncrypt.rar 这个类是关于加密,解密的操作,文件的一些高级操作1.使用 缺省密钥字符串 加密/解密string2.使用 给定密钥字符串 加密/解密string3.使用 缺省密钥字 ...

  9. json解析异常 - net.sf.json.JSONException: java.lang.reflect.InvocationTargetException

    注:在项目中, 我使用原生的ajax请求数据的时候, JSONObject没能帮我解析, 当却不给我报错, 我是在junit单元测试中测试的时候, 发现的.发现好多时候, 特别是通过ajax请求, 不 ...

  10. Codeforces 551E - GukiZ and GukiZiana(分块)

    Problem E. GukiZ and GukiZiana Solution: 先分成N=sqrt(n)块,然后对这N块进行排序. 利用二分查找确定最前面和最后面的位置. #include < ...