我用這個代碼導航抽屜安卓熱門NavigationView內容不見了
<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">
<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"
android:visibility="visible">
<include
layout="@layout/menu"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.NavigationView>
menu.xml文件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="ir.app.ir.live24.MainActivity"
android:clickable="false"
android:gravity="center"
android:background="#fff">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/textView3"
android:textColor="#000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/textView4"
android:textColor="#000"
android:layout_weight="0.5" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/textView5"
android:textColor="#000" />
</LinearLayout>
</RelativeLayout>
鑑於Android的工作室工作正確: 但在設備後http://i65.tinypic.com/wtvu4k.jpg
發射,菜單頂部已經消失: http://i68.tinypic.com/2nu0ub5.jpg
下一個問題是:點擊不是菜單操作
請幫我
我不使用菜單,組和項目。我想要使用線性佈局。我可以嗎 ? –
看到這個:http://stackoverflow.com/questions/30626324/navigationview-and-custom-layout ..它可能有助於 – rafsanahmad007
我檢查它。這個答案會在