0
私は完璧に動作するナビゲーションドロワーを持っていますが、ナビゲーションメニューを1つ選択すると(下の画像を参照してください)、ツールバーの上にビューが追加されます。Androidのツールバーの上に表示
はここに私の引き出しのxml
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:title="My Dashboard"
android:id="@+id/nav_item_home"
android:icon="@drawable/ic_home"/>
<item android:title="Random Check"
android:id="@+id/nav_item_random_check"
android:icon="@drawable/random_check"/>
<item android:title="Verify Reference"
android:id="@+id/nav_item_verify_receipt"
android:icon="@drawable/verify_receipts"/>
<item android:title=" Meter Reading"
android:id="@+id/nav_item_meter_reading"
android:icon="@drawable/meter_reading"/>
<group android:id="@+id/group_settings_id">
<item android:title="Help"
android:id="@+id/nav_item_help"
android:icon="@drawable/help"/>
</group>
<item android:title="Logout"
android:id="@+id/nav_item_logout"
android:icon="@drawable/logout"/>
</menu>
主な活動xmlです:
は、ここに私のフラグメントレイアウト
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:id="@+id/random_check_layout"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/randomCheckDescription"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="40dp"
android:layout_marginTop="30dp"
android:gravity="center"
android:text="This scans the barcode of any existing business"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:orientation="horizontal">
<EditText
android:id="@+id/txtRandomCheckBacode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12dp"
android:inputType="text"
android:hint="barcode"
android:textColorHint="@color/edit_text_hint"
android:textColor="@color/edit_text"
android:paddingLeft="10dp"
android:paddingBottom="10dp"
android:background="@drawable/edit_text_bottom_border"
android:layout_marginLeft="20dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:orientation="horizontal"
android:weightSum="1">
<ImageButton
android:id="@+id/btnScanBarcode"
android:layout_width="fill_parent"
android:layout_height="28dp"
android:text="@string/scan_hint"
android:layout_marginRight="20dp"
android:background="@color/white"
android:textColor="@color/white"
android:layout_marginLeft="2dp"
android:src="@drawable/ic_scan"
android:contentDescription="@string/scan_hover" />
</LinearLayout>
</LinearLayout>
<android.support.v7.widget.AppCompatButton
android:id="@+id/btnRandomCheckSubmit"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:layout_marginTop="80dp"
android:text="Proceed"
android:background="@drawable/custom_button"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:textColor="@color/white"
android:foreground="?android:selectableItemBackground" />
</LinearLayout>
</ScrollView> </LinearLayout>
イメージです。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/menu_bar_color"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:title="@string/app_name" />
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/containerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"></FrameLayout>
<android.support.design.widget.NavigationView
android:id="@+id/shitstuff"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/header"
app:itemTextColor="@color/dark_grey"
app:menu="@menu/drawermenu" />
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
は – Kushal
おかげであなたはNavigationViewを実装するあなたの.xmlコードを共有ねえ、私が求めていますあなたがandroid.support.design.widget.NavigationViewを使用したレイアウト.xmlコード – Innocent
...あなたのフィードバックのための – Kushal