搜索
您的当前位置:首页正文

Android 自定义checkbox图片过大问题

来源:二三娱乐

首先我们新建一个drawable,属性是selector,设置俩张图片,用以checked时切换图片。

然后定义一个style,CheckBox_style

<style name="wrist_light_screen_checkbox"parent=>

<itemname="android:button">@nullitem><itemname="android:background">@drawable/checkbox_selectoritem>

</style>

注意parent所指定的style,以及item 的button,background的属性设定。

最后,在布局文件里使用CheckBox即可

<CheckBox android:id="@+id/cb_switch"

android:layout_width="45dp"

android:layout_height="45dp"

style="@style/wrist_light_screen_checkbox"/>

这样,CheckBox里的图片大小便得到了修改。

Top