2
我想獲得一個線上有三個按鈕。中間最遠的一個,最右側的一個。理想情況下,我希望中心按鈕佔據兩邊之間的所有空間。現在中心(菜單)按鈕只是與左側(prev)按鈕重疊。以下是我現在有:如何在兩個其他按鈕之間居中按鈕?
<RelativeLayout android:layout_marginTop="-50dip" android:gravity="bottom" android:layout_height="wrap_content" android:layout_width="fill_parent">
<Button
android:id="@+id/previous_button"
android:layout_height="wrap_content"
android:layout_width="110px"
android:layout_alignParentLeft="true"
android:text="@string/previous"
/>
<Button
android:id="@+id/menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="center"
android:text="@string/menu"
/>
<Button
android:id="@+id/next_button"
android:layout_height="wrap_content"
android:layout_width="110px"
android:layout_alignParentRight="true"
android:text="@string/next"
/>
感謝,完美的工作:) – tylercomp 2010-09-01 19:49:25
你變換了的RelativeLayout到LinearLayout中......如果你wan't保持你的RelativeLayout,只是把機器人:layout_toRightOf = 「@ ID/previous_button」(HTTP://開發商.android.com/reference/android/widget/RelativeLayout.LayoutParams.html#attr_android:layout_toRightOf) – fedj 2010-09-01 20:04:58
@tylercomp非常好,很高興它適合你!在計算器上,如果答案提交回答您的問題,您應該選中答案左邊的複選框將其標記爲asnwer。 – 2010-09-01 20:38:39