mercredi 7 juin 2017

Cannot change checkbox color API 19

I'm trying to change checkbox color on Api <21 like this:

<android.support.v7.widget.AppCompatCheckBox 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@android:color/white"
            android:id="@+id/chSave"
            android:checked="false"
            android:layout_centerVertical="true"
            app:buttonTint="@android:color/white"
            android:layout_toRightOf="@id/txtterms" />

also tried setting theme like this:

<style name="checkBoxStyle" parent="Theme.AppCompat">
    <item name="colorAccent">#ffffff</item>
    <item name="android:textColorSecondary">#ffffff</item>
</style>


<android.support.v7.widget.AppCompatCheckBox 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@android:color/white"
            android:id="@+id/chSave"
            android:checked="false"
            android:layout_centerVertical="true"
            app:theme="@style/checkBoxStyle"
            app:buttonTint="@android:color/white"
            android:layout_toRightOf="@id/txtterms" />

and also tried with just CheckBox without appcompat.

Layout is in DialogFragment, tried changing it to AppCompatDialogFragment, changing theme to appcompat but none of it helped.

Using custom drawable is a last resort. So is there any other chance to achieve this?




Aucun commentaire:

Enregistrer un commentaire