如何設(shè)置導(dǎo)航抽屜從右到左打開首先我知道這個(gè)問題出現(xiàn)在這里之前,但在嘗試了很多之后我仍然沒有成功。我從Android Developers網(wǎng)站開始研究這個(gè)例子 。我正在嘗試將菜單設(shè)置為從右到左打開,而不是在示例中如何實(shí)現(xiàn)(從左到右)。此外,我想將打開菜單按鈕移動(dòng)到操作欄的右側(cè)。我也在這里提出了一些答案,例如在這個(gè)答案中。我嘗試改變視圖和布局的重力,但我得到錯(cuò)誤:沒有抽屜視圖發(fā)現(xiàn)絕對(duì)重力LEFT你可以幫我弄清楚我的代碼中有什么問題,為了設(shè)置菜單從右邊打開,我應(yīng)該改變什么,并將操作欄按鈕移動(dòng)到右側(cè)?xml代碼在這里:<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_gravity="right"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="@+id/content_frame"
android:layoutDirection="rtl"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<ListView android:id="@+id/left_drawer"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="10dp"
android:background="#111"/></android.support.v4.widget.DrawerLayout>
3 回答

翻閱古今
TA貢獻(xiàn)1780條經(jīng)驗(yàn) 獲得超5個(gè)贊
將此代碼添加到清單:
<application android:supportsRtl="true">
然后在Oncreate上編寫此代碼:
getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
這個(gè)對(duì)我有用。;)
- 3 回答
- 0 關(guān)注
- 570 瀏覽
添加回答
舉報(bào)
0/150
提交
取消