The checkbox border is invisible on white background.
I played with different color parameters without success. I need black border of box. Yes, there examples to make custom checkbox. In all drawable examples the normal box is visible inside of new shape. And the drawable shape is narrow without text in android:text=""
But why checkbox does not look okay in usual xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layoutBottom1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#FFFFFF"
android:gravity="center"
>
<CheckBox
android:id="@+id/checkBottom1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AAAA"
android:visibility="visible"
android:textColor="#000000"
android:checked="true"
/>
</LinearLayout>
Any ideas? Thanks!
It's too late to answer but I would like to share what worked for me. Paste below code. It would change the
CheckBox
border color andtextColor
styles.xml
now in your main_activity.xml place below
CheckBox
codeif above style not working then replace parent theme
parent="Theme.AppCompat.NoActionBar"
withparent="Theme.AppCompat.Light"
. Hope it would work.You can use the property
android:buttonTint="what you want"
to set your checkbox border color.Did you try going through here, here and here?
And as per answering your question
Thats because sometimes, the android graphical view is not able to render the custom views, in that case you need to run the code on the emulator or the device to test it out.
UPDATE In case you dont want to use drawables, then you can also define the drawable shape in xml like