android DatePickerDialog theme
网上搜索了下没有找到DatePickerDialog的各种 Theme 的样例。我就一个一个试了下,传上图片
DatePickerDiaolog有两个构造函数分别是:
DatePickerDialog(Context context, DatePickerDialog.OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth)
DatePickerDialog(Context context, int theme, DatePickerDialog.OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth)
其中第一个构造函数没有指定theme就是用工程的默认theme下的DatePickerDialog把
第二个构造函数的第二个参数表示的就是DatePickerDialog的几种风格了。可以是以下常量:
对应的视图效果:
‘’
Demo:
对应生成一个DatePickerDialog的代码如下
Dialog dialog=new DatePickerDialog(
mContext,
DatePickerDialog.THEME_DEVICE_DEFAULT_DARK,
new DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
}
},
1990,8,16);//表示默认的年月日
dialog.show();
添加 设置 取消按钮 (有些手机界面被定制了 没有取消按钮)
//添加确定按钮
mDialog.setButton(DatePickerDialog.BUTTON_POSITIVE,
mContext.getResources().getString(R.string.hint_ok),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
flag = true;
}
});
//添加取消按钮
mDialog.setButton(DatePickerDialog.BUTTON_NEGATIVE,
mContext.getResources().getString(R.string.hint_cancel),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
flag = false;
}
});
android DatePickerDialog theme的更多相关文章
- android 中theme样式的解释
android:theme="@android:style/Theme.Dialog" : Activity显示为对话框模式 android:theme="@androi ...
- 解决android:theme="@android:style/Theme.NoDisplay" 加入这句话后程序不能运行
原因: 原来用的是ActionBarActivity,继承自 ActionBarActivity的类必须指定固定的集中Theme风格,而这些 Theme 风格是需要导入V7中的 appcompat L ...
- Android主题theme和风格style总结
用到了Android的主题和风格,感觉很多地方需要总结和记录下来.其实主题和风格是有很大的作用的,特别是界面要求比较高的客户端. Style:是一个包含一种或者多种格式化属性的集合,我们可以将其用为一 ...
- Android中theme.xml与style.xml的区别
一.相同点 两者的定义相同.继承方式也相同 <?xml version="1.0" encoding="utf-8"?> <resources ...
- Android 主题theme说明 摘记
主题Theme就是用来设置界面UI风格,可以设置整个应用或者某个活动Activity的界面风格.在Android SDK中内置了下面的Theme,可以按标题栏Title Bar和状态栏Status B ...
- Android studio使用android:style/Theme.Dialog报错:You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
查找原因是在activity java代码部分继承了compatactivity public class DialogActivity extends AppCompatActivity 但是在An ...
- Android 指定 Theme
在 application 标签中添加 android:theme="@android:style/Theme.Holo.Light.NoActionBar"
- android 中theme.xml与style.xml的区别
from://http://liangoogle.iteye.com/blog/1848448 android 中theme.xml与style.xml的区别: 相同点: 两者的定义相同. <r ...
- android应用Theme(二)
另外一种实现android应用Theme的方式是通过apk来实现的. 以下是一个demo. 1.首先必须新建一个apk.类似的插件,然后在该apk的AndroidManifest.xml文件的appl ...
随机推荐
- 容易上手-类似ERP系统 简单特效
今天大概简单写一个效果, 这个效果 很容易 上手的: html: <style type="text/css">.menu_list ul{display:none;} ...
- Python读取PDF内容
1,引言 晚上翻看<Python网络数据采集>这本书,看到读取PDF内容的代码,想起来前几天集搜客刚刚发布了一个抓取网页pdf内容的抓取规则,这个规则能够把pdf内容当成html来做网页抓 ...
- 稠密图(邻接矩阵),并查集,最短路径(Dijkstra,spfa),最小生成树(kruskal,prim)
全部函数通过杭电 1142,1162,1198,1213等题目测试. #include<iostream> #include<vector> #include<queue ...
- PNPOLY - Point Inclusion in Polygon W. Randolph Franklin
测试目标点是否在多边形内int pnpoly(int nvert, float *vertx, float *verty, float testx, float testy) { int i, j, ...
- Oracle EBS-SQL (INV-1):检查物料成本为0并且物料状态不是'NEW'的物料.sql
select --msi.inventory_item_id --,msi.organization_id msi.segment1 ...
- 转:Javascript异步编程的4种方法
你可能知道,Javascript语言的执行环境是"单线程"(single thread). 所谓"单线程",就是指一次只能完成一件任务.如果有多个任务,就必须排 ...
- 二叉查找树的Insert和Delete操作
struct TreeNode{ SearchTree Left; SearchTree Right; ElementType Ele; }; /*递归一定有出口*/ /*递归代码就是要重复使用*/ ...
- 利用boost做string到wstring转换,以及字符集转换 - Error - C++博客
利用boost做string到wstring转换,以及字符集转换 - Error - C++博客 利用boost做string到wstring转换,以及字符集转换 #include <boost ...
- javascript实现小九九乘法口诀
<!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/h ...
- 原生网络请求以及AFN网络请求/异步下载
这里对网络请求方式做一个总结. 原生方式同步GET请求: NSString *urlStr = @"http://apis.juhe.cn/mobile/get?phone=13429667 ...