Android Theme theme inheritance (themes under the SDK and themes under the v7 package)

Theme styles are generally inherited in two styles in the styles.xml file:

  1. Inherit android theme

    <style name="AppBaseTheme" parent="android:Theme.Holo">

    If you rewrite the style, you need to add android: to the name . You can see that the parent parent class reference uses parent=" android: Theme.Holo"

    <item name="android:actionBarStyle">@style/MyActionBar</item>

  2. Inherit the AppCompat theme (theme under the v7 package)

    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

    If you rewrite the style, you don't need to add android: to the name. You can see that there is no "android:" in the parent class reference.

    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>

Summary: It should be that the theme of custom inheritance from androidSDK needs to add "android:", and the theme of custom inheritance v7 package does not need to be added .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324489955&siteId=291194637