MasterofProject

Custom CheckBox check and no style

Classification: Android finishing 158 people read Comment(0) Collection Report

When we do APP applications, we often use CheckBox controls, but the system's original CheckBox style and does not meet our needs, we want to customize the CheckBox selected or not, in fact, the same as Button, set its choice or no background.

Layout is as follows:

<CheckBox
@+id/foot_mark_cb "android:id="
Wrap_content "android:layout_width="
Wrap_content "android:layout_height="
True "android:layout_alignParentLeft="
15dp "android:layout_marginLeft="
True "android:layout_centerInParent="
10dp "android:paddingLeft="
            Android:button= "@drawable/common_radionbutton_selector"
Select "android:text="
12sp "android:textSize="
#333333 "android:textColor="
>

The key is "@drawable/common_radionbutton_selector", as follows:

<? Version= encoding= "1" XML "UTF-8" >
Xmlns:android= <selector "http://schemas.android.com/apk/res/android" >
<item android:drawable= "@drawable/common_rb_checked" android:state_enabled= "true" android:state_focused= "true" / >
<item android:drawable= "@drawable/common_rb_checked" android:state_enabled= "true" android:state_pressed= "true" / >
<item android:drawable= "@drawable/common_rb_checked" android:state_enabled= "true" android:state_selected= "true" / >
<item android:drawable= "@drawable/common_rb_checked" android:state_checked= "true" android:state_enabled= "true" / >
<item android:drawable= "@drawable/common_rb_nomal" / >
</selector>

Then you can achieve the effect you want, such asCommon_rb_checked picture is UI to cut, ha ha

Copyright statement: This article is the original article of the main Bo, without the permission of the owner.

Top
0
Step
0
Guess what you're looking for.
View comments
* above the user's comments only represent their personal views, do not represent the views or position of the CSDN website
    Personal data
    • Visit36079 times
    • Integral:1740
    • Grade
    • Rank:13010th
    • Original144
    • Reprint:36
    • Translation:1
    • Comment:9
    Latest comments