Reputation: 189474
I'm starting an app that should use the material design theme.
But the minSDK for that project is api level 15.
How do I set up the app to use as much Material Design as possible on lower versions on Android?
Upvotes: 2
Views: 1058
Reputation: 189474
I followed the guide that was recommended by Dodge.
Add
compile 'com.android.support:appcompat-v7:21.0.2'
to your dependencies.
Now put a style into your values folder:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">@color/primary</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">@color/primary_dark</item>
<!-- colorAccent is used as the default value for colorControlActivated
which is used to tint widgets -->
<item name="colorAccent">@color/accent</item>
<!-- You can also set colorControlNormal, colorControlActivated
colorControlHighlight & colorSwitchThumbNormal. -->
</style>
</resources>
Now you have to add it to your application in your manifest:
<application
android:name=".BaseApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
This setup inherits from a NoActionBar theme to make it possible to also use the compat Toolbar.
Upvotes: 1