简体   繁体   English

Android:android.app.Dialog.setTitle()不显示对话框标题

[英]Android: android.app.Dialog.setTitle() doesn't show title of dialog

I am using android.app.Dialog and using setTitle("title"); 我正在使用android.app.Dialog并使用setTitle("title"); method but it doesn't show the dialog title bar. 方法,但不显示对话框标题栏。 I have also used the following style for that activity in menifest file. 在清单文件中,我还对该活动使用了以下样式。

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

May be this style automatically applies for dialog as well. 可能是此样式也自动应用于对话框。 How can I show the title bar without changing the windowNoTitle to false ? 如何在不将windowNoTitle更改为false情况下显示标题栏? I also don't want to use AlertDialog instead of Dialog . 我也不想使用AlertDialog而不是Dialog

You need to change your style to Check this style may be this will work. 您需要将样式更改为“检查此样式是否可行”。

 <style name="picture_dialog_style" parent="@android:style/Theme.Holo.Dialog.NoActionBar">
    <item name="android:windowFrame">@null</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:windowIsTranslucent">false</item>
    <item name="android:windowNoTitle">false</item>
    <item name="android:background">@android:color/white</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:backgroundDimEnabled">true</item>
    <item name="android:textColor">@color/colorOrange</item>
    <!--<item name="android:windowAnimationStyle">@style/PauseDialogAnimation</item>-->
</style>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM