2012-10-22 123 views
0

有誰知道如何縮小自定義單選按鈕?繪圖大小爲200x200px,但設置layout_width或width只是顯示原始圖像的一部分。自定義單選按鈕過大

我可以通過爲四種密度創建不同的尺寸來實現,但我認爲這不是正確的方法。必須有一種方法來縮小它!或者有可能,沒有?

<RadioGroup 
     android:id="@+id/rg" 
     android:layout_width="wrap_content" 
     android:layout_marginTop="10dp" 
     android:layout_height="wrap_content" > 

     <RadioButton 
      android:id="@+id/radioButton1" 
      android:width="30dp" 
      android:height="30dp" 
      android:button="@drawable/rb_selector" 
      android:text="Don't stop me now" 
      /> 

     <RadioButton 
      android:id="@+id/radioButton2" 
      android:width="30dp" 
      android:height="30dp" 
      android:button="@drawable/rb_selector" 
      android:text="I want to break free" /> 

     <RadioButton 
      android:id="@+id/radioButton3" 
      android:width="30dp" 
      android:height="30dp" 
      android:button="@drawable/rb_selector" 
      android:text="Bohemian rhapshody" /> 


     <RadioButton 
      android:id="@+id/radioButton4" 
      android:width="30dp" 
      android:height="30dp" 
      android:button="@drawable/rb_selector" 
      android:text="Another one bites the dust" /> 

</RadioGroup> 
+1

您無法縮小可繪製的按鈕。您需要各種密度的各種版本 – njzk2

+0

與CheckBoxes是否一樣? – erdomester

+0

請將此添加爲正確答案 – erdomester

回答

1

android:buttonandroid:checkmarkandroid:drawable_*從不進行縮放。用於顯示它們的大小取決於它們在其中找到的密度文件夾。