我有一个启动画面和其他活动。
我的想法是,我希望启动画面全屏,并且所有其他活动都像往常一样拥有标题栏和ActionBar。
我在styles.xml文件中设置了2个样式
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<!-- Splash theme. -->
<style name="Splash" parent="@style/Theme.AppCompat.Light">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
然后在清单文件中我放
android:theme="@style/AppTheme"
之后,我迷路了:我试图将风格和/或主题设置为使用&#34; Splash&#34;对于xml代码中的splashScreen,但它没有工作
设置清单样式会更改所有应用程序活动,我只想更改一个
任何帮助都将不胜感激。
答案 0 :(得分:1)
更改活动主题,而不是应用主题。
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:fullBackupContent="false"
android:label="@string/app_name"
android:theme="@style/AppTheme"> <!-- Not here -->
<activity
android:name=".SplashActivity"
android:theme="@style/Splash" /> <!-- Change/add here -->
但请注意:parent="Theme.AppCompat.Light.NoActionBar"
是您想要的工具栏
答案 1 :(得分:0)
您只需要使用工具栏创建您希望拥有的每个活动的样式。
例如,在您的清单文件中,您可以适应全局样式:
<application
android:theme="@style/AppTheme">
之后你必须在每个活动中写下你想要的风格:
<activity
android:name=".SplashActivity"
android:theme="@style/Splash">
</activity>