Reputation: 9123
My activity_main.xml still uses the default theme even after I specified another theme. Please find my code below:
styles
<resources>
<!-- Launch screen -->
<style name="LaunchScreenTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
</style>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
manifest
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
...
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
...
android:theme="@style/LaunchScreenTheme"
tools:context=".MainActivity">
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:src="@drawable/logo_orange"
/>
</LinearLayout>
Even though I've set the LaunchScreenTheme
above, it still uses the default AppTheme
Any idea why?
Upvotes: 0
Views: 158
Reputation: 352
if you want to set a theme specifically for an activity then you have set it like this in your manifest -
<activity
android:name=".StartActivity"
android:theme="@style/LaunchScreenTheme" />
if you want to set a theme for the whole application then you have to set it like this is your manifest -
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/LaunchScreenTheme">
...
Upvotes: 1
Reputation: 4442
In activity_main.xml
, try style:"@style/LaunchScreenTheme"
instead android:theme="@style/LaunchScreenTheme"
Upvotes: 1