2

I am using AppCompatCheckBox in XML layout as given below,

<android.support.v7.widget.AppCompatCheckBox
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text=""
        android:id="@+id/checkBox"
        android:buttonTint="@color/appColor"
        android:layout_centerVertical="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginLeft="15dp"
        android:layout_marginStart="15dp" />

But the check box is not visible on device running 4.3. But CheckBox text is visible, but not the CheckBox. Whats wrong here?

I am following this link. See the answer with 5 Points.

Community
  • 1
  • 1
Zach
  • 9,989
  • 19
  • 70
  • 107

1 Answers1

2

I don’t know if this solves, but you don’t need to use AppCompatCheckBox; a simple CheckBox is enough.

The activity you are using, presumably an AppCompatActivity, automatically inflates layout checkboxes as AppCompatCheckBoxs.

AppCompat* widgets should be used only when creating views at runtime, e.g. new AppCompatCheckBox(context) or when subclassing.

natario
  • 24,954
  • 17
  • 88
  • 158