當前位置:首頁 » 安卓系統 » android單選鈕

android單選鈕

發布時間: 2023-08-16 19:51:36

Ⅰ 如何實現android中三個單選按鈕橫向排列且只能選一個

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/row_item_margin">

<TextView
android:id="@+id/tvStorageWay"
style="@style/EditTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="儲存方式:"/>

<RadioGroup
android:id="@+id/rgStorageWay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/tvStorageWay"
android:gravity="center_vertical"
android:orientation="horizontal">

<RadioButton
android:id="@+id/rbPack"
style="@style/EditTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@null"
android:drawableLeft="@drawable/selector_login_mode_radiobutton"
android:text="包裝"/>

<RadioButton
android:id="@+id/rbBulk"
style="@style/EditTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/row_item_margin"
android:layout_weight="1"
android:button="@null"
android:drawableLeft="@drawable/selector_login_mode_radiobutton"
android:text="散裝"/>

<RadioButton
android:id="@+id/rbStorageWayOther"
style="@style/EditTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/row_item_margin"
android:layout_weight="1"
android:button="@null"
android:drawableLeft="@drawable/selector_login_mode_radiobutton"
android:text="其它"/>
</RadioGroup>
</RelativeLayout>

Ⅱ 問一下 android radiobutton控制項 控制單選按鈕和文字之間的距離的問題

我覺得RadioButton原始的button如果設置為 android:button="@null「 而用android:drowableLeft=」@drawable/radiobtn_selector「;這樣顯示圖片的話效果會更加好,而且可以用android:drawablePading=」10dp「這個屬性控制圖片和字兒的距離。

希望可以幫到你。Thanks

Ⅲ android單選按鈕

你要當成單選的一組的radiobutton要放在radioGROUP下,不然這個GROUP就沒起作用
只有這樣寫,才能實現這組radiobutton是單選的效果。

Ⅳ android 用imageview實現單選功能

imageView2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
v.setBackgroundResource(null); v.setBackgroundResource(R.drawable.adddoorbellon);
ImageView imageView = (ImageView) findViewById(R.id.yimenling_oneclick);
imageView.setBackgroundResource(R.drawable.akeyconfiguration);
}
});

這樣試試,,最好把你的錯誤日誌發出來

熱點內容
java類訪問限制 發布:2025-09-13 16:04:20 瀏覽:971
cnc編程的管理 發布:2025-09-13 15:53:12 瀏覽:59
如何設置windows密碼 發布:2025-09-13 15:17:29 瀏覽:957
sql北京 發布:2025-09-13 15:11:34 瀏覽:221
腳本怎麼保存 發布:2025-09-13 15:11:29 瀏覽:646
安卓軟體下載證書在哪裡 發布:2025-09-13 15:10:51 瀏覽:450
解壓擺球 發布:2025-09-13 14:47:22 瀏覽:212
源碼下載靠譜 發布:2025-09-13 14:27:30 瀏覽:962
倉庫解壓碼流 發布:2025-09-13 14:20:30 瀏覽:893
在線編程少兒 發布:2025-09-13 14:19:29 瀏覽:388