I want to use the AppTheme android:Theme.Material.Light.DarkActionBar for my app. This is available from SDK 21...My minimum SDK is 16. I have the support library com.android.support:appcompat-v7:22.0.0 in my build gradle file. I want to create a second styles file under the the values folder. I want to have two styles files...one for Lollipop...greyed out version 22 next to it...and one for pre Lollipop. How to do this?
As said create a values folder for a specific Api Level
res/values-v21/styles.xml
res/values/styles.xml
In values/styles.xml
create to styles:
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/primaryColor</item>
<item name="colorPrimaryDark">@color/primaryColorDark</item>
<item name="colorAccent">@color/accentColor</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style
<style name="AppTheme" parent="AppTheme.Base">
</style>
In values-v21/styles.xml
create to styles:
<!-- Themes for Android API21 -->
<style name="AppTheme" parent="AppTheme.Base">
<item name="android:colorPrimary">@color/primaryColor</item>
<item name="android:colorPrimaryDark">@color/primaryColorDark</item>
<item name="android:colorAccent">@color/accentColor</item>
</style>
Inside your AndroidManifest.xml
you should use AppTheme
as your global application theme
Further you should use the Toolbar
from the SupportLibary instead of the default Actionbar. This is why the Base Theme sets the Actionbar to false
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