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

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

熱點內容
隨機啟動腳本 發布:2025-07-05 16:10:30 瀏覽:525
微博資料庫設計 發布:2025-07-05 15:30:55 瀏覽:24
linux485 發布:2025-07-05 14:38:28 瀏覽:304
php用的軟體 發布:2025-07-05 14:06:22 瀏覽:754
沒有許可權訪問計算機 發布:2025-07-05 13:29:11 瀏覽:430
javaweb開發教程視頻教程 發布:2025-07-05 13:24:41 瀏覽:695
康師傅控流腳本破解 發布:2025-07-05 13:17:27 瀏覽:239
java的開發流程 發布:2025-07-05 12:45:11 瀏覽:684
怎麼看內存卡配置 發布:2025-07-05 12:29:19 瀏覽:282
訪問學者英文個人簡歷 發布:2025-07-05 12:29:17 瀏覽:833