[英]Android resize checkbox
我為復選框創建了自己的選擇器,但無法更改其大小。 如果我將wrap_content的layout_height設置為20dp,則行高會變小,但復選框的大小會保持彼此重疊。 如果我用layout_height和width設置android:height =“ 20dp”和android:width =“ 20dp”,則不會發生任何事情。 為什么?
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@drawable/cbon" />
<item android:state_checked="false" android:drawable="@drawable/cboff" />
</selector>
<CheckBox
android:id="@+id/multiple_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="center_vertical"
android:checked="true"
android:button="@drawable/productlists_custom_cb"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false" />
你為什么不放
android:layout_width="20dip"
android:layout_height="20dip"
僅在布局xml中。 那行得通,但不是您希望看到的方式。 為什么不將圖像用作復選框,然后將其調整為所需的大小。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.