我正在嘗試使用3個按鈕與中心對齊進行線性佈局。Android-按鈕的一部分從佈局中刪除
但是,在設置了一些重量並將空間置於其間之後,最後一個按鈕的佈局中有1/4被刪除,不可見並且不可點擊。其他部分雖然工作得很好。
對不起它的一個新的帳戶,所以我不能嵌入的截圖,而不是請點擊以下鏈接:
,並請另見下文
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="horizontal"
android:weightSum="4">
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<!--Nesting Structured Layout-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:weightSum="10"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:layout_weight="2">
<!--This is for the Start button-->
<Button
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:text="@string/starting_button"/>
<!--Spacing-->
<Space
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<!--This is for the Message button-->
<Button
android:layout_weight="3"
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="@string/liitle_message_button"/>
<!--Spacing-->
<Space
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<!--This is for the Settings button-->
<Button
android:layout_weight="3"
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="@string/settings_button"/>
</LinearLayout>
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
</LinearLayout>
什麼碼導致問題的代碼問題?還有其他更好的方法來達到相同的結果嗎?
P.S對不起,作爲一個非英語母語的用戶,我很抱歉,它可能有大量的語法錯誤或以不禮貌的方式提問,請讓我知道你是否感到冒犯。
我既然對不起我遲到的答覆 – Noobnewbier
我是新來的stackoverflow,我噸希望我會有電子郵件每次我有一個答案......但似乎它不是它的工作方式TAT – Noobnewbier
沒問題,你的問題解決了嗎? – Avin