【发布时间】:2012-04-26 19:14:59
【问题描述】:
我更改了 Android 2.3.4 复选框的位图,并希望设置位图的大小以缩放它们。我像这样更改了复选框:
<CheckBox
android:id="@+id/cb1"
android:button="@drawable/checkbox"
android:layout_alignParentLeft="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Sort: 1" />
使用匹配的 xml 可绘制对象
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:state_focused="true" android:drawable="@drawable/checkbox_on_background_focus_yellow"/>
<item android:state_checked="false" android:state_focused="true" android:drawable="@drawable/checkbox_off_background_focus_yellow"/>
<item android:state_checked="false" android:drawable="@drawable/checkbox_off_background" />
<item android:state_checked="true" android:drawable="@drawable/checkbox_on_background" />
</selector>
如何设置 dip/dp 值来更改复选框位图的大小?
【问题讨论】:
标签: java android checkbox bitmap