对话框中显示的应用程序名称(标题)
App name(title) showing in a dialog
在我的应用程序中,我使用 activity 作为 dialog.Everything 工作正常但是有一个小 problem.Whenever 对话框显示,标题栏是 visible.I已经完成 requestWindowFeature(Window.No.Title)
但标题栏仍然出现。
xml
<style name="CustomDialog" parent="Theme.AppCompat.Light.Dialog">
<item name="android:windowNoTitle">true</item>
</style>
您使用了错误的主题
使用这个
android:Theme.DeviceDefault.Dialog.NoActionBar
您也可以隐藏操作栏程序。
为此你必须在 onCreate 方法中使用它
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar actionBar = getActionBar();
actionBar.hide();
}
这个怎么样?
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); //before
dialog.setContentView(R.layout.logindialog);
在显示对话框之前添加这个
这个答案最初来自 here
在我的应用程序中,我使用 activity 作为 dialog.Everything 工作正常但是有一个小 problem.Whenever 对话框显示,标题栏是 visible.I已经完成 requestWindowFeature(Window.No.Title)
但标题栏仍然出现。
xml
<style name="CustomDialog" parent="Theme.AppCompat.Light.Dialog">
<item name="android:windowNoTitle">true</item>
</style>
您使用了错误的主题
使用这个
android:Theme.DeviceDefault.Dialog.NoActionBar
您也可以隐藏操作栏程序。
为此你必须在 onCreate 方法中使用它
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar actionBar = getActionBar();
actionBar.hide();
}
这个怎么样?
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); //before
dialog.setContentView(R.layout.logindialog);
在显示对话框之前添加这个
这个答案最初来自 here