I've got a problem with hiding the box of my CheckBox. My CheckBox looks like this at the moment:
<CheckBox
android:id="@+id/favoritesBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:button="@null"
android:tag="1"
android:textStyle="italic"
android:text="@string/details_tags_favs" />
The only problem here is, the button=@null is removing its style and its not completely gone. Because of that, my text is not centered but moved to the right (by box size).
Is there a smooth way to get rid of it completely in API 16 and lower?
With a little help from from Andrew T. with my RubberDuck debugging I found solution for this problem.
What you have to do is set background="@android:color/transparent on CheckBox and the invisible box will be gone from your View.
So my new CheckBox looks like this:
<CheckBox
android:id="@+id/favoritesBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:button="@null"
android:background="@android:color/transparent"
android:tag="1"
android:textStyle="italic"
android:text="@string/details_tags_favs" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With