自定义AlertDialog在android-7.0上距离屏幕边界margin无法消除问题
来源:互联网 发布:node会取代php吗 编辑:程序博客网 时间:2024/06/05 06:47
项目中用到拍照选择图片功能,选择图片弹窗用的是自定义AlertDialog。这个没什么难度。UI要求 对话框宽度铺满,底部在屏幕底部,无margin和padding。这个是实现起来挺简单的。想着布局里边不加margin和padding不久ok了
但是在自己手机小米5(android-7.0版本)安装看了下(顺带说一下小米5 在7.0版本下竟然不能连接androidstudio安装调试应用,这个有点扯),竟然有一块区域无法充满。如下图:
后来和同事讨论会不会是AlertDialog默认主题的原因。
WindowManager m = getWindow().getWindowManager(); Display d = m.getDefaultDisplay(); // 获取屏幕宽、高用 WindowManager.LayoutParams p = getWindow().getAttributes(); p.width = (int) (d.getWidth()); // 宽度设置为屏幕的k宽// if(height > 0){// p.height = (int) (d.getHeight() * height);// } p.horizontalMargin = 0.0f; p.verticalMargin = 0.0f;
getWindow().setBackgroundDrawable(null);
BackgroundDrawable制空发现可行。最终结果如图:
1 0
- 自定义AlertDialog在android-7.0上距离屏幕边界margin无法消除问题
- android中碰撞屏幕边界反弹问题
- Android之自定义AlertDialog无法监听控件
- 解决在自定义AlertDialog中EditText无法弹出软键盘的问题
- Android学习问题:关于AlertDialog中自定义布局带有的EditText无法弹出键盘
- android自定义AlertDialog背景、背景边框消除、自定义背景按钮监听事件
- android消除屏幕锁
- AlertDialog自定义view中edittext无法弹出问题
- android margin相同距离不一致
- Android实现自定义AlertDialog的自下向上的动画效果(并消除dialog边框)
- android自定义AlertDialog对话框中的EditText无法弹出输入法解决方案
- AlertDialog自定义样式问题
- Android 自定义 Dialog 无法横向铺满屏幕
- 如何在SAP屏幕上自定义按钮?
- margin:0 auto在ie中无法居中问题
- android 之自定义 AlertDialog
- android Alertdialog 自定义
- android AlertDialog自定义大小
- eclipse新浪云sae插件安装
- Shell 间接变量问题
- 实施CMMI3有感:CMMI绝对是治疗软件公司特大毒瘤的特效药!
- 155_集合_Collection集合的常用方法详解_03_contains
- Codeforces 793D Presents in Bankopolis DP
- 自定义AlertDialog在android-7.0上距离屏幕边界margin无法消除问题
- EmguCV 一些基本操作
- jq 获取option 选中的各种值
- "解决“就是当做信仰的存在
- 'OSError: .*.so: undefined symbol'
- 线性表—顺序存储结构-顺序表
- hadoop全分布式环境配置-访问slave节点路径不存在问题
- 大数相乘 例 n的阶乘
- 常用转义字符(摘自W3School )