當前位置:首頁 » 安卓系統 » 安卓單選框怎麼布局成橫向

安卓單選框怎麼布局成橫向

發布時間: 2023-06-05 10:32:54

『壹』 如何實現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>

『貳』 安卓UI界面設計,如何布局呢

一、界面布局之線性布局()

這種布局比較常用,也比較簡單,就是每個元素佔一行,把它按照橫向排放,也就是每個元素佔一列。在布局中都按照垂直或者水平的順序依次排列子元素,每一個子元素都位於前一個元素之後。

二、界面布局之相對布局()

相對布局是android界面設計中比較常用和好用的一個布局方式。

三、界面布局之表格布局(TableLayout)

表格布局採用行、列的形式來管理元素組件。TableLayout的行和列不需要聲明,而是採用添加方法控制。

每次在TableLayout中添加一個TableRow,一個TableRow就代表表格中的一行,也同樣是容器,往裡面添加一個子組件就代表增加一列。在表格布局中,列的寬度由最寬的那個單元格蔽消決宏知知定,整個表格布局寬度取決於父容器的寬度

四、界面布局之絕對布局()

特點:以坐標的方式來定位在屏幕上的位置,引起缺乏靈活性,在沒有絕對定位的情況下相比其他類型的布局更難維護

五、界面布局之幀布局(FrameLayout)

FrameLayout是五大布局中最猛戚簡單的一個布局。在幀布局中,整個界面被當成一塊空白備用區域,所有的子元素都不能被指定放置的位置,它們統統放於這塊區域的左上角,並且後面的子元素直接覆蓋在前面的子元素之上,將前面的子元素部分和全部遮擋。

熱點內容
筆記本電腦一般存儲空間 發布:2025-02-08 23:51:15 瀏覽:835
php網站優化 發布:2025-02-08 23:49:41 瀏覽:455
php網頁列印 發布:2025-02-08 23:40:02 瀏覽:820
windowssmb無法訪問 發布:2025-02-08 23:33:28 瀏覽:467
python27編譯器 發布:2025-02-08 23:29:20 瀏覽:339
如何運行python代碼 發布:2025-02-08 23:28:15 瀏覽:692
新箱子密碼鎖怎麼設置 發布:2025-02-08 23:26:50 瀏覽:148
安卓如何可以看見被撤回的消息 發布:2025-02-08 23:19:17 瀏覽:798
火影忍者競技場腳本 發布:2025-02-08 23:10:18 瀏覽:935
英國訪問學者簽證費用 發布:2025-02-08 23:04:46 瀏覽:927