1
我有一個Activity
的佈局,我試圖添加一個導航抽屜。DrawerLayout中視圖的大小和點擊行爲錯誤
的問題是,能正常工作,我需要使用:的
<android.support.v4.widget.DrawerLayout
代替:
<RelativeLayout
但它攪亂的事情了。我ProgressBar
變得更大,我的RecyclerView
不起作用,應用程序日誌我出去當我點擊的東西,等
我的佈局XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.st.mf.UserAreaActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:padding="@dimen/activity_vertical_margin"
android:background="#fff">
<ProgressBar
android:id="@+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginTop="20dp" />
<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:menu="@layout/navigation_menu"
android:layout_gravity="start">
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
我如何創建我的抽屜菜單不搞亂一切其他呢?
'DrawerLayout'應該只有一個內容'View'。將'ProgressBar'和'RecyclerView'放在'ViewGroup'中,就像垂直的'LinearLayout'一樣。 –
@MikeM。非常感謝你。你介意給我一個例子,讓我更好地想象它嗎? –
你的意思是一個佈局XML的例子? –