Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.9k views
in Technique[技术] by (71.8m points)

android - How to decrease radio button drawable size?

I have four radio button.

xml source

<RadioButton
    android:id="@+id/fragBtn1"
    android:layout_width="0dp"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:background="@drawable/btn_bg_selector"
    android:button="@null"
    android:drawableTop="@drawable/btn_img_selector" />

btn_img_selector

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/selected_btn" android:gravity="center" android:state_checked="true"/>
    <item android:drawable="@drawable/nonselected_btn" android:gravity="center"/>
</selector>

btn_bg_selector

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@color/btnPressed" android:state_pressed="true"/>
    <item android:drawable="@color/btnNonPressed"/>
</selector>

But button image is too big.
I want to decrease a button image size only..(not decrease button size)
For example, I want to scale a button image size 30px * 30px.
Is it possible?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Sclae the button

<RadioButton
        android:scaleX="0.75"
        android:scaleY="0.75" />

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...