2010-10-12 65 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是给我身边的我的形象幅度较大,由乔提到