2017-04-15 4 views
1

私はこの質問が以前に尋ねられたことは知っていますが、AndroidStudioの新しいバージョンのように変わってしまったようです。 Eitehrways、古い解決策は動作していないか、私は間違ったことをしています。ナビゲーションバーをアクションバーの下に表示するにはどうすればよいですか?

XML:あなたのDrawerLayout

<?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_homescreen" 
     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:menu="@menu/activity_homescreen_drawer" /> 

</android.support.v4.widget.DrawerLayout> 

答えて

2

がレイアウトでアプリケーションバーの上にあるが、そのためには、その上に描画します。これはApp Barが働いたのnav引き出し

+0

ああの「上に」描かれるようになります

<FrameLayout 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" ... > <include layout="@layout/app_bar_homescreen" ... /> <android.support.v4.widget.DrawerLayout ...> ... rest of your XML layout </DrawerLayout> </FrameLayout> 

はあなたのような何かをする必要があります。私が試したときにそれが前になかった理由は、android:fitsSystemWindowsがtrueに設定されていたからです! – newToEverything

関連する問題