Android 创建没有标题栏的对话框
16lz
2021-01-23
FEATURE_NO_TITLE works when creating a dialog from scratch, as in:
Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
But it doesn't work when creating an AlertDialog (or using the Builder), because it already disables the title and use a custom one internally.
I have looked at the SDK sources, and I think that it can't be worked around. So to remove the top spacing, the only solution is to create a custom dialog from scratch IMO, by using the Dialog class directly.
Also, one can do that with a style, eg in styles.xml:
<style name="FullHeightDialog" parent="android:style/Theme.Dialog"> <item name="android:windowNoTitle">true</item> </style>
And then:
Dialog dialog = new Dialog(context, R.style.FullHeightDialog);
更多相关文章
- 代码中设置drawableleft
- android 3.0 隐藏 系统标题栏
- Android开发中activity切换动画的实现
- Android(安卓)学习 笔记_05. 文件下载
- Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
- 技术博客汇总
- android 2.3 wifi (一)
- AndRoid Notification的清空和修改
- Android中的Chronometer