3
我正在使用自定義單選按鈕。 radiogroup的每個元素都有2個圖片,在android:button屬性中定義了2個狀態。Android中帶有圖像的RadioButton底部顯示文本
我想添加文本,但它顯示在圖像下,有沒有辦法顯示圖像底部的文字?
main_activity.xml
<RadioButton
android:id="@+id/radioAlc"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:checked="true"
android:layout_marginRight="10dp"
android:button="@drawable/policeradio"
android:text = "text1"
/>
<RadioButton
android:id="@+id/radioCrash"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:button="@drawable/carcrashradio"
android:layout_marginRight="10dp"
android:text = "text2"
/>
<RadioButton
android:id="@+id/radioMarch"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:button="@drawable/marchradio"
android:text = "text3"
/>
</RadioGroup>
繪製/ carcrash.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/carcrash" android:state_checked="true"></item>
<item android:drawable="@drawable/carcrash_gris" ></item>
安卓drawableTop是確定的,但文本列顯示! Tx –
文字垂直顯示,因爲你有'width =「50dp」' – ramaral
將android:textSize =「11sp」添加到'RadioButton' – ramaral