我有一個Button,它是SlidingDrawer的句柄。我想要在SlidingDrawer按鈕手柄的同一行上訪問另一個按鈕。這對於LinearLayout或RelativeLayout來說似乎不可行,但我可以通過FrameLayout使其工作。將FrameLayout移動到左側(包含SlidingDrawer按鈕的句柄)
我的問題是這樣的:句柄按鈕將只顯示在屏幕的中心。我希望每個按鈕位於屏幕的兩側(按鈕手柄位於右側,而另一個按鈕位於左側)。我該如何將這個FrameLayout-wrapped按鈕移動到屏幕的右側?一切都被包裹在一個RelativeLayout中,但我還沒有能夠實現這個按鈕的移動。
相關的Android XML佈局代碼(再次,所有包裹在一個RelativeLayout的):
<Button android:id="@+id/EditListActivityButton"
android:text="@string/mappage_edititems"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/addItemSlidingDrawerHandle"
android:layout_above="@+id/item">
</Button>
<SlidingDrawer android:id="@+id/addItemSlidingDrawer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:handle="@+id/addItemSlidingDrawerHandle"
android:content="@+id/addItemSlidingDrawerContent"
android:layout_above="@+id/item"
android:layout_alignParentRight="true">
<FrameLayout android:id="@id/addItemSlidingDrawerHandle"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_toRightOf="@+id/goToEditListButton">
<Button android:id="@+id/addItemSlidingDrawerHandleButton"
android:text="@string/mappage_additem"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</Button>
</FrameLayout>
<LinearLayout android:id="@id/addItemSlidingDrawerContent"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical"
android:background="#96C120">
<!-- sliding drawer content goes here -->
</LinearLayout>
</SlidingDrawer>
我不希望SlidingDrawer從右向左打開 - 我想要右側的句柄。我希望整個事情從下到上打開,這是標準的方式。 – DashRantic
好吧,看看這是否有助於你http://stackoverflow.com/questions/6894149/how-to-change-android-slidingdrawer-handle-button-position – voidRy
正如我在我的問題所述,我需要兩個按鈕行。正如我在我的問題中所述,RelativeLayout對此沒有幫助。 – DashRantic