I have very simple checkbox:

<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/clipboardBtn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:button="@drawable/clipboard_checkbox" /> 

For checked/unchecked I have two different images.

After migration to AndroidX I see default image for Android on devices below API 21.

What I've tried already:

  • change CheckBox to AppCompatCheckbox (from AndroidX) - nothing changed
  • set background to checkbox & set android:button="@null" - background is OK, but I still see default image on background (see image below)

Seems that Android completly disrespect button attribute.

example of background set to img and button to null

I am out of ideas. For Lollipop+ everythink works as it should. Have anyone faced issue like this? Only change I did was migration to AndroidX :/

0 Answers