2017-04-08 65 views
-1

我用AndroidStudio.But附带的DrawerLayout创建了一个活动。当我使用RecyclerView时,RecyclerView填满了整个屏幕......?DrawerLayout与RecyclerView冲突? RecyclerView填充整个屏幕

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true" 
tools:openDrawer="start"> 
    <include 
     layout="@layout/app_bar_main" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 
    <android.support.design.widget.NavigationView 
     android:id="@+id/nav_view" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     android:fitsSystemWindows="true" 
     app:headerLayout="@layout/nav_header_main" 
     app:menu="@menu/activity_main_drawer" /> 
    <android.support.v7.widget.RecyclerView 
     android:layout_marginTop="20dp" 
     android:id="@+id/titleList" 
     android:layout_width="match_parent" 
     android:layout_height="80dp"/> 
</android.support.v4.widget.DrawerLayout> 

The Button on the left top can't be used.Guess it was coverd by RecyclerView

dsajfhkjasldfkj

+0

你不希望你的'RecyclerView'那里。你需要把它放在内容'View'中;即''的布局。你可能有一个'content_main'布局。它会去那里。 –

回答

0

你的布局需要像这样进行结构化:

​​
+0

谢谢你......我解决了它 –

+0

我很高兴你能解决你的问题,然后回答我的问题。不过,如果你赞扬和/或标记我的答案,如果它帮助你:) –