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

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

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

熱點內容
linuxshell密碼 發布:2025-05-14 17:21:11 瀏覽:199
安卓手機聽筒在哪裡關閉 發布:2025-05-14 17:16:20 瀏覽:454
我的世界炸毀50萬伺服器 發布:2025-05-14 17:16:07 瀏覽:123
存儲站源 發布:2025-05-14 17:14:20 瀏覽:863
win2008的ftp設置 發布:2025-05-14 17:03:31 瀏覽:663
萊克發的工資卡密碼是多少 發布:2025-05-14 16:57:10 瀏覽:178
方舟怎麼用自己的存檔進入別人的伺服器 發布:2025-05-14 16:46:25 瀏覽:877
微博視頻高清上傳設置 發布:2025-05-14 16:38:41 瀏覽:548
資料庫圖書管理設計 發布:2025-05-14 16:33:52 瀏覽:378
php開發的網頁 發布:2025-05-14 16:22:03 瀏覽:478