How to use device default theme? If I use this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@android:style/Theme.DeviceDefault">
</style>
</resources>
it is crashing application. Exception
How to use device default theme? If I use this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@android:style/Theme.DeviceDefault">
</style>
</resources>
it is crashing application. Exception
I don't know if the theming is the issue but to apply themes you will do the following..
add/change in styles.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="AppTheme.Base"/>
<style name="AppTheme.Base" parent="Theme.AppCompat">
<item name="colorPrimary">@color/primaryColor</item>
<item name="colorPrimaryDark">@color/primaryColorDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="StyledDialog.Base" parent="Theme.AppCompat.Dialog">
<item name="colorPrimary">@color/primaryColor</item>
<item name="colorPrimaryDark">@color/primaryColorDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
create a folder in res called values-v21 and copy the styles.xml into now change there the code to something like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<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/colorAccent</item>
</style>
<style name="StyledDialog" parent="Theme.AppCompat.Dialog">
<item name="colorPrimary">@color/primaryColor</item>
<item name="colorPrimaryDark">@color/primaryColorDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
In your manifest you will have to call the theme by
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
Now your app will support the default theming of Lollipop and earlier versions of android.
Edit: Don't get confused by the "Dialog"-entries.. I just overwrite them to apply the theming to them with an other style..