當前位置:首頁 » 安卓系統 » 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);
}
});

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

熱點內容
adobereader如何加密 發布:2025-03-15 04:17:10 瀏覽:538
c語言基本數據 發布:2025-03-15 04:15:50 瀏覽:731
安卓哪裡下游戲大廳 發布:2025-03-15 04:08:35 瀏覽:827
鴻蒙編譯後的45款軟體 發布:2025-03-15 04:06:18 瀏覽:638
jetsql 發布:2025-03-15 03:59:30 瀏覽:203
程序常用演算法 發布:2025-03-15 03:47:16 瀏覽:6
雷速安卓版本怎麼不推送 發布:2025-03-15 03:42:57 瀏覽:18
nodejs搭建視頻伺服器 發布:2025-03-15 03:37:54 瀏覽:106
編譯器將固定字元串放在固定位置 發布:2025-03-15 03:36:11 瀏覽:364
高中生電腦編程培訓 發布:2025-03-15 03:11:04 瀏覽:50