mercredi 18 avril 2018

checkbox customize center align

I want to use checkbox in my android app. But because I want no text beside it so the checkbox square is aligned left. after some search and some changes I faced some thing strange: one centered square whose over lapping another left aligned square, checkbox over lapped.

how can I hide smaller one and keep bigger center one. here is my checkbox attributes:

<CheckBox
    android:id="@+id/checkBox_setting"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:foreground="@drawable/checkbox_selector"
    android:foregroundGravity="center"
    android:background="@drawable/txt_left_corner"/>

and my checkbox_selector.xml is down here:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/ic_unchecked"
    android:state_checked="false"/>
<item android:drawable="@drawable/ic_checked"
    android:state_checked="true"/>

can You help me please ?




Aucun commentaire:

Enregistrer un commentaire