dialog居于底部并使得宽度占满整个屏幕宽度
2018-01-17 16:56
351 查看
http://blog.csdn.net/jdfkldjlkjdl/article/details/52233737
imageDialog.show();
Window window = imageDialog.getWindow();
if (imageDialog != null && window != null) {
window.getDecorView().setPadding(0, 0, 0, 0);
WindowManager.LayoutParams attr = window.getAttributes();
if (attr != null) {
attr.height = ViewGroup.LayoutParams.WRAP_CONTENT;
attr.width = ViewGroup.LayoutParams.MATCH_PARENT;
attr.gravity = Gravity.BOTTOM;//设置dialog 在布局中的位置
window.setAttributes(attr);
}
}
imageDialog为我们定义的对话框,在imageDialog.show()后面加这一段代码,可以实现从底部弹窗,并且占据整个屏幕宽度的对话框,因为我发现dialog 默认的样式@android:style/Theme.Dialog 对应的style 有pading属性,所以
win.getDecorView().setPadding(0, 0, 0, 0); 就能够水平占满了在此记录之,以备重用。
imageDialog.show();
Window window = imageDialog.getWindow();
if (imageDialog != null && window != null) {
window.getDecorView().setPadding(0, 0, 0, 0);
WindowManager.LayoutParams attr = window.getAttributes();
if (attr != null) {
attr.height = ViewGroup.LayoutParams.WRAP_CONTENT;
attr.width = ViewGroup.LayoutParams.MATCH_PARENT;
attr.gravity = Gravity.BOTTOM;//设置dialog 在布局中的位置
window.setAttributes(attr);
}
}
imageDialog为我们定义的对话框,在imageDialog.show()后面加这一段代码,可以实现从底部弹窗,并且占据整个屏幕宽度的对话框,因为我发现dialog 默认的样式@android:style/Theme.Dialog 对应的style 有pading属性,所以
win.getDecorView().setPadding(0, 0, 0, 0); 就能够水平占满了在此记录之,以备重用。
相关文章推荐
- dialog居于底部并使得宽度占满整个屏幕宽度
- dialog居于底部并使得宽度占满整个屏幕宽度
- 216_实现width宽度充满占满屏幕的底部菜单dialog
- android 如何让自定义dialog的宽度充满整个屏幕
- 自定义dialog的宽度充满整个屏幕宽度的问题
- android 如何让自定义dialog的宽度充满整个屏幕?
- android 如何让自定义dialog的宽度充满整个屏幕?
- Android自定义dialog从屏幕底部弹出并且充满屏幕宽度
- android 使dialog的宽度充满整个屏幕
- Android自定义dialog从屏幕底部弹出并且充满屏幕宽度
- android 5.0以上版本自定义dialog从屏幕底部弹出并且充满屏幕宽度
- Android实践-自定义dialog从屏幕底部弹出并且充满屏幕宽度
- Android实践-自定义dialog从屏幕底部弹出并且充满屏幕宽度
- Android屏幕底部弹出DialogFragment(3)
- (转)自定义Dialog宽度占满屏幕
- 自定义Dialog宽度占满屏幕
- Android 弹出对话框Dialog充满屏幕宽度
- 微信小程序页面使内容充满整个屏幕(高度、宽度100%),并使内容水平和竖直都居中
- tableView 分割线宽度没占据整个屏幕的宽度
- 使BT5任务栏充满整个屏幕底部的办法