我已经将活动的主题设置为Android:theme =“ @android:style/theme.dialog”,但我也想删除活动的标题栏。因此,如何使用Android:theme =“@android:style/theme.black.notitlebar.fullscreen”以及对话框主题。

有帮助吗?

解决方案

尝试创建扩展的自定义样式 Theme.Dialog:

<resources>
    <style name="DialogNoTitle" parent="android:Theme.Dialog">
        <item name="android:windowNoTitle">true</item>
    </style>
</resources>

其他提示

我相信您可以在活动的ongreate()中指定这一点:

requestWindowFeature(Window.FEATURE_NO_TITLE);

为了 AppCompat, ,以下解决方案对我有用:

添加新的主题样式,没有动作栏 styles.xml 并设置 parent="Theme.AppCompat.NoActionBar".

<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">

    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimary</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:windowBackground">@color/colorPrimary</item>

</style>


现在在您的Splash屏幕活动中实现相同的主题样式 androidManifest.xml

<activity
        android:name=".ActivityName"
        android:theme="@style/SplashTheme"> // apply splash them here 

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
</activity>

这是结果:

enter image description here

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top