I would like to change the color of ColorPrimaryDark for just one activity. How can I do this?
I think go to the styles.xml and change this:
<item name="colorPrimaryDark">@color/blue</item>
But the problem is if I do this I change the color of all my activities and I just need to change the color of one activity.
Thank you for your help!
To be specific, this color is the color of the bar at the top of the app I mean above of ActionBar
. I use Kotlin to do this.
Create a theme specifically for that Activity
.
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimaryDark">@color/gray</item>
<!-- Your application theme -->
</style>
<style name="BlueActivityTheme" parent="AppTheme">
<item name="colorPrimaryDark">@color/blue</item>
</style>
Then in your manifest, apply the theme to only that Activity
:
<activity android:name="com.example.app.BlueActivity"
android:theme="@style/BlueActivityTheme"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With