mardi 11 août 2015

Cannot get Material Design CheckBox to use styling

I am trying to add two CheckBox views to a feedback Fragment in my current app, which is using the AppCompat library (v7:22.2.1) . The API range for this app is 16-current (22). My manifest is set up with the following theme definition:

android:theme="@style/AppTheme"

which is defined as such in my styles.xml file:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>

    <style name="AppTheme.FacebookFlatButton">
        <item name="android:background">@drawable/facebook_flat_button</item>
        <item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
        <item name="android:textColor">@android:color/white</item>
    </style>

    <style name="AppTheme.TwitterFlatButton">
        <item name="android:background">@drawable/twitter_flat_button</item>
        <item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
        <item name="android:textColor">@android:color/white</item>
    </style>

</resources>

The problem is my CheckBox (and I also notice my EditText) views don't default to a proper color such that they are viewable when checked. Here is a screenshot of the Preview in Android Studio and my emulator side-by-side:

Android Studio and Emulator

No matter what combination of style items I put in this style from other SO articles such as this one, the colors don't change in the emulator or on a device, but they are updating in the Preview. I have also tried various tweaks of the parent theme to my custom theme, but nothing seems to matter.

I have tried this in a Nexus 5 (API 19) and a Nexus 6 (API 22) emulator, and it also does the same thing on my Nexus 6 device.

I'm not defining much at all custom here, but I still feel like I'm missing some small critical piece of information here. What am I missing?




Aucun commentaire:

Enregistrer un commentaire