我想知道如何使用的RelativeLayout爲了使這樣的tructure:的Android RelativeLayout的兩個按鈕rightof一個按鈕
三個按鈕,我們姑且稱之爲A B和C;我想把B和C放在另一個的上面,把它們放在A的右邊,作爲一個匹配A的寬度和高度的單個塊(所以我們將B和C的高度設爲A的一半,但是相同的寬度)。
因爲我還不能在這裏發表圖片,你可以找到我要找的圖像:http://img191.imageshack.us/img191/9765/stackg.jpg
我寫了一篇關於這部分的代碼是這一個:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/black"
android:paddingLeft="16dp"
android:paddingRight="16dp" >
<Spinner
android:id="@+id/A"
android:layout_width="0dp"
android:layout_height="96dp"
android:layout_below="@id/another_block_that_fills_all_the_line"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/B" />
<Spinner
android:id="@id/B"
android:layout_width="96dp"
android:layout_height="48dp"
android:layout_below="@id/another_block_that_fills_all_the_line"
android:layout_alignParentRight="true" />
<Spinner
android:id="@id/C"
android:layout_width="96dp"
android:layout_height="48dp"
android:layout_below="@id/B"
android:layout_alignParentRight="true" />
</RelativeLayout>
的問題在於它不會隨着每個屏幕而擴展,因爲我必須設置靜態大小。我嘗試了很多不同的解決方案,比如對layout_align使用所有可能的組合,甚至隨機更改wrap_content,但仍然無法按照我希望它們使用靜態大小的方式來適應它們。
我已經更新我的答案。覈實。我認爲這正是你需要的 –