您好,登錄后才能下訂單哦!
在 Android 中,RadioButton 控件默認是沒有圓角的,但可以通過自定義樣式來設置圓角。
首先,在 res/drawable 文件夾下創(chuàng)建一個 XML 文件,比如命名為 rounded_radio_button.xml,內(nèi)容如下:
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="10dp" />
<solid android:color="#FFFFFF" />
</shape>
然后,在 res/layout 文件夾下的布局文件中使用這個自定義的 XML 文件作為 RadioButton 的背景:
<RadioButton
android:id="@+id/radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@null"
android:background="@drawable/rounded_radio_button"
android:text="RadioButton"
android:textSize="16sp"
android:textColor="@color/black" />
這樣就可以實現(xiàn)給 RadioButton 控件設置圓角效果了。您可以根據(jù)自己的需求調(diào)整圓角的半徑和背景顏色等屬性。
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。