當前位置:首頁 » 安卓系統 » android自定義單選

android自定義單選

發布時間: 2025-06-24 11:07:37

『壹』 android關於單選框和下拉框的問題,或者有沒更好的解決方案,我的目的是通過單選框的改變

var cc3 = $('.formc select[@name="country"]').attr("id");
//清空下拉框//
$("#select").empty();$("#select").html('');
//添加下拉框的option
$("<option value='1'>1111</option>").appendTo("#select")
稍微解釋一下:
select[@name='country'] option[@selected]
表示具有name 屬性,並且該屬性值為』country』 的select元素裡面的具有selected 屬性的option 元素。可以看出有@開頭的就表示後面跟的是屬性。
單選框:
//得到單選框的選中項的值(注意中間沒有空格)
$("input[@type=radio][@checked]").val();
//設置單選框value=2的為選中狀態.(注意中間沒有空格)
$("input[@type=radio][@value=2]").attr("checked",'checked');
復選框:
//得到復選框的選中的第一項的值 再不懂得花 請給我90財富 再說

『貳』 如何實現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中按鈕共分為幾種

在Android開發中,View控制項被廣泛應用於各種界面設計,根據其功能和用途,可以將它們分為多種類型。其中,文本類控制項包括TextView、EditText、AutoCompleteTextView、MultAutoCompletTextView、TextSwitcher、DigitalClock、ExtractEditText、CheckedTextView和Chronometer,這些控制項主要用於顯示或編輯文本信息。

按鈕類控制項包括Button、CheckBox、RadioButton(RadioGroup)、ToggleButton和ImageButton,它們主要用於用戶交互,實現按鈕點擊、復選框選擇、單選按鈕選擇等功能。

縮放按鈕主要指ZoomButton和ZoomControls,用於實現縮放功能。

圖片類控制項則包括ImageView、ZoomButton、ImageButton和ImageSwitcher,它們用於顯示圖像資源,可以進行放大、縮小等操作。

時間控制項如DigitalClock、AnalogClock、TimePicker和DatePicker,用於顯示和選擇時間或日期。

進度顯示控制項包括ProgressBar、AbsSeekBar、SeekBar和RatingBar,它們用於顯示進度條或評分。

導航控制項如TabHost和TabWidget,用於實現標簽頁導航。

視頻媒體控制項包括VideView和MediaController,用於播放視頻內容。

Dialog對話框包括CharacherPickerDialog、AlertDialog、DatePickerDialog、ProgressDialog和TimePickerDialog,它們用於彈出對話框,提供選擇、輸入等功能。

布局類控制項包括AbsoluteLayout、LinearLayout、RadioGroup、TableLayout、TableRow、RelativeLayout和FrameLayout,用於實現復雜的界面布局。

需要適配器的布局類控制項包括AdapterView、AbsListView、GridView、ListView、AbsSpinner和Gallery,它們用於顯示列表或網格數據。

滾動條控制項包括HorizontalScrollView和ScrollView,用於實現垂直或水平滾動功能。

網頁顯示控制項為WebView,用於顯示網頁內容。

動畫類控制項包括ViewAnimator、ViewFilpper、ViewSwitcher、ImageSwitcher和TextSwitcher,用於實現界面動畫效果。

『肆』 請問android 編程中可不可以自定義單選框,怎樣實現。謝謝!

可以,使用style就行了,自定義style後就可以去掉自帶的圓圈圈,在設置背景的時候會使用到shape,使用shape設置按下狀態等等

熱點內容
資料庫約束是什麼 發布:2025-09-20 12:14:07 瀏覽:740
我的世界統一驗證伺服器 發布:2025-09-20 11:51:59 瀏覽:187
dialogandroid 發布:2025-09-20 11:32:18 瀏覽:472
手機軟體用什麼伺服器 發布:2025-09-20 11:26:35 瀏覽:361
搜索php內容 發布:2025-09-20 11:25:05 瀏覽:226
python的quote 發布:2025-09-20 11:07:56 瀏覽:338
vb60連接資料庫 發布:2025-09-20 10:56:18 瀏覽:289
c語言ltoa 發布:2025-09-20 10:51:35 瀏覽:509
mysql的存儲過程參數類型 發布:2025-09-20 10:41:58 瀏覽:819
linux系統怎麼掛伺服器 發布:2025-09-20 10:26:43 瀏覽:872