0

我有一个导航抽屉活动。汉堡包和设置按钮在 Lollipop 中可见,但在 Lollipop 以下版本中不可见。但是,如果我触摸那个区域,它工作正常,它只是,不可见。

我的xml代码:

  1. app_bar_nav

    <?xml version="1.0" encoding="utf-8"?>
    <android.support.design.widget.CoordinatorLayout     
    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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".activities.Home">
    
    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">
    
        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />
    
    </android.support.design.widget.AppBarLayout>
    
    <include layout="@layout/content_home_nav" />
    
    
      </android.support.design.widget.CoordinatorLayout>
    

2.content_nav

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:background="@drawable/home_background"
tools:showIn="@layout/app_bar_home_nav"
android:weightSum="3">

   <RelativeLayout
   android:layout_width="match_parent"
   android:layout_height="0dp"
   android:layout_weight="1">

  </RelativeLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:orientation="horizontal"
    android:weightSum="3">

    <ImageView
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_margin="15dp"
        android:src="@drawable/home_reminders"
        android:layout_height="wrap_content"
        android:id="@+id/imageView_home_reminders" />

    <ImageView
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_margin="15dp"
        android:src="@drawable/home_orders"
        android:layout_height="wrap_content"
        android:id="@+id/imageView_home_orders" />

    <ImageView
        android:layout_width="0dp"
        android:layout_weight="1"
        android:src="@drawable/home_vitals"
        android:layout_margin="15dp"
        android:layout_height="wrap_content"
        android:id="@+id/imageView_home_vitals" />
</LinearLayout>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1">

</RelativeLayout>
</LinearLayout>

3.activity_nav

   <?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"
    tools:openDrawer="start">

    <include
        layout="@layout/app_bar_home_nav"
        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:itemTextColor="#000000"
        app:menu="@menu/activity_home_nav_drawer" />

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

棒棒糖的截图:

棒棒糖屏幕截图

非(下)棒棒糖的截图

下面是棒棒糖截图

4

1 回答 1

0
        final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawerLayout, toolbar, R.string.abc_action_bar_home_description, R.string.abc_action_bar_home_description) {
            @Override
            public void onDrawerSlide(View drawerView, float slideOffset) {
                super.onDrawerSlide(drawerView, slideOffset);
            }
        };
        drawerLayout.setDrawerListener(toggle);
        toggle.syncState();
于 2016-02-04T08:28:25.143 回答