android自定義單選
『壹』 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設置按下狀態等等