Android Dialog 系统样式讲解及透明背景
2017-05-26 15:37
453 查看
转自:http://blog.sina.com.cn/s/blog_3e333c4a0102vk0f.html
AlertDialog.Builder builder = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_TRADITIONAL);//传统主题
![](http://s10.sinaimg.cn/small/0018CBLAzy6P0S408Hf99&690)
AlertDialog.Builder builder = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_HOLO_DARK);//使用深色背景 主题
![](http://s13.sinaimg.cn/small/0018CBLAzy6P0S9Mkm87c&690)
AlertDialog.Builder builder = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_HOLO_LIGHT);//使用浅色背景 主题
![](http://s5.sinaimg.cn/small/0018CBLAzy6P0Se4dJaa4&690)
AlertDialog.Builder builder = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_DEVICE_DEFAULT_DARK);//使用默认设备 深色主题
![](http://s1.sinaimg.cn/small/0018CBLAzy6P0SjMjYs60&690)
AlertDialog.Builder builder = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);//使用默认设备 浅色主题
![](http://s4.sinaimg.cn/small/0018CBLAzy6P0SlG62L83&690)
//自定义布局
View layout = getActivity().getLayoutInflater().inflate(R.layout.mydialog,null);
AlertDialog.Builder dialog = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_DEVICE_DEFAULT_DARK);
final AlertDialog dialog = builder.create();
dialog.setView(layout);
//透明
Window window = dialog.getWindow();
WindowManager.LayoutParams lp = window.getAttributes();
lp.alpha = 0.9f;
window.setAttributes(lp);
。。。
dialog.show();
AlertDialog.Builder builder = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_TRADITIONAL);//传统主题
AlertDialog.Builder builder = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_HOLO_DARK);//使用深色背景 主题
AlertDialog.Builder builder = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_HOLO_LIGHT);//使用浅色背景 主题
AlertDialog.Builder builder = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_DEVICE_DEFAULT_DARK);//使用默认设备 深色主题
AlertDialog.Builder builder = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);//使用默认设备 浅色主题
//自定义布局
View layout = getActivity().getLayoutInflater().inflate(R.layout.mydialog,null);
AlertDialog.Builder dialog = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_DEVICE_DEFAULT_DARK);
final AlertDialog dialog = builder.create();
dialog.setView(layout);
//透明
Window window = dialog.getWindow();
WindowManager.LayoutParams lp = window.getAttributes();
lp.alpha = 0.9f;
window.setAttributes(lp);
。。。
dialog.show();
相关文章推荐
- Android Dialog 系统样式讲解及透明背景
- Android Dialog 系统样式讲解及透明背景
- Android Dialog 系统样式讲解及透明背景
- Android Dialog 系统样式讲解及透明背景
- Dialog_ _dialog系统样式讲解 及 透明背景
- 我的Android进阶之旅------>Android中Dialog系统样式讲解
- android dialog 背景透明的样式
- Android中Dialog系统样式讲解
- Android Dialog 系统样式讲解及透明背景
- android 自定义Dialog背景透明及显示位置设置(转载)
- android自定义dialog弹出框、透明背景
- android 自定义Dialog背景透明及显示位置设置
- Android:使用自定义透明Dialog样式的Activity
- Android Dialog背景全透明无边框 Theme Style
- Android背景透明的 Dialog
- android 自定义Dialog背景透明及显示位置设置
- Android背景透明的 Dialog
- android 自定义Dialog背景透明及显示位置设置
- Android有趣的全透明效果--Activity及Dialog的全透明(附android系统自带图标大全)
- android 自定义Dialog背景透明及显示位置设置