android - How to inherit from a style specified from a different api version -
this pretty basic question - supporting api versions 11+ , want use functionality on phones have newer api version. however, nice if didn't have re-define style. so, example, if, in values/styles.xml have:
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="theme.myapp.input.text"> <item name="android:layout_width">match_parent<item> <item name="android:layout_height>wrap_content</item> </style> </resources>
and in values-v14/styles.xml have:
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="theme.myapp.input.text"> <item name="android:textallcaps">true</item> </style> </resources>
then, on devices have api 14+, i'll union of 2 styles.
the question quite old possible: following snippet values/styles.xml
<style name="apptheme" parent="theme.appcompat.light.darkactionbar"> <item name="colorprimary">@color/green</item> <item name="colorprimarydark">@color/dark</item> <item name="coloraccent">@color/green</item> <item name="checkboxstyle">@style/apptheme.checkbox</item> </style>
if want inherit (for eg) same style , specialize in api >=23 must define values/style-23.xml below:
<style name="apptheme.apptheme23" > <item name="android:windowlightstatusbar">true</item> </style>
obviously in androidmanifest.xml theme specify is:
android:theme="@style/apptheme"
that's folks!
Comments
Post a Comment