博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Android Dialog 系统样式讲解及透明背景
阅读量:6985 次
发布时间:2019-06-27

本文共 1027 字,大约阅读时间需要 3 分钟。

 
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();
 

转载地址:http://ftmpl.baihongyu.com/

你可能感兴趣的文章
servlet生命周期
查看>>
Python数据分析
查看>>
mui进度条使用解析
查看>>
IntelliJ idea 创建Maven多模块项目并运行
查看>>
一步一步教你如何搭建自己的视频聚合站
查看>>
使用canvas实现图片压缩
查看>>
一步一步开发安卓下的react-native应用系列之第一个RN应用
查看>>
JVM类加载过程 & 双亲委派模型
查看>>
【IE8】在IE8 使用 button 时需要为标签指定相应的 type 类型
查看>>
[转]:PHP 使用协同程序实现合作多任务
查看>>
RegExp对象
查看>>
Hazelcast更换CEO,承诺继续造福开源社区
查看>>
开源项目越来越商业友好,谁来负责开发者友好呢?
查看>>
AWS太过强势?VMware为自保疑与微软达成合作
查看>>
2016年,移动开发领域有哪些最佳实践值得参考?
查看>>
练出更好的团队
查看>>
甲骨文解散Java Mission Control团队事件新进展
查看>>
一次Java字节码插桩实战
查看>>
下一代微服务!Service Mesh 2018年度总结
查看>>
知乎推荐页Ranking构建历程和经验分享
查看>>