2010-10-12 62 views

回答

1

setWidth(int)setHeight(int)因爲CheckBox延伸CompoundButton延伸Button

嘗試參照this tutorial

Alernatively嘗試通過XML改變它:

<CheckBox 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="new checkbox" 
    android:background="@drawable/my_checkbox_background" 
    android:button="@drawable/my_checkbox" /> 
+0

我通過代碼創建CheckBox和使用setWidth(),並自動調用setHeight()方法,但仍寬度和高度沒有改變。任何其他解決方案? – 2010-10-12 13:16:19

+0

我用一些其他方法更新了我的答案 – BeRecursive 2010-10-12 13:21:35

1

簡單使用se tWidth(w)和setHeight(h)的功能與普通Button相同。

0

UPDATE:從API 17日起這隻作品...


按我對這個問題的回答: - how can we reduce the size of checkbox please give me an idea


CheckBox源於其高度從文本以及圖像。如果你不想要的文字(爲我工作)

android:text="" 
android:textSize="0sp" 

當然,這僅適用於:

在XML來設置這些特性。

如果沒有這些變化,CheckBox是給我身邊的我的形象幅度較大,由喬提到