Android 导航抽屉-只有图标和非常大的

Android 导航抽屉-只有图标和非常大的,android,material-design,navigation-drawer,Android,Material Design,Navigation Drawer,我在活动中实现了导航抽屉。我的应用程序的受众是老年人,我希望图标非常大,占据整个抽屉的高度 我希望有4个图标均匀分布,没有文字,只有大图标。我试过玩标签: <dimen name="design_navigation_icon_size" tools:override="true"></dimen> 但我一直没能让它发挥作用。当图标在顶部附近变得太大时,它们只是彼此重叠。图像似乎总是包含在标题布局中。为抽屉创建自定义视图和布局 <android.suppo

我在活动中实现了导航抽屉。我的应用程序的受众是老年人,我希望图标非常大,占据整个抽屉的高度

我希望有4个图标均匀分布,没有文字,只有大图标。我试过玩标签:

<dimen name="design_navigation_icon_size" tools:override="true"></dimen>


但我一直没能让它发挥作用。当图标在顶部附近变得太大时,它们只是彼此重叠。图像似乎总是包含在标题布局中。

为抽屉创建自定义视图和布局

 <android.support.design.widget.NavigationView
    android:id="@+id/nav_view_left"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:fitsSystemWindows="true"
    app:headerLayout="@layout/nav_header_left" />

nav_header_left.xml

 <?xml version="1.0" encoding="utf-8"?>
  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:background="@color/right_side_header_bg_color"
    android:theme="@style/ThemeOverlay.AppCompat.Dark"
    android:paddingTop="@dimen/fifty"
    android:paddingRight="@dimen/twenty"
    android:paddingLeft="@dimen/twenty"
    android:orientation="vertical"
    android:weightSum="4">

    <TextView
        android:id="@+id/add_txt"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:text="Gallery"
        android:drawableLeft="@android:drawable/ic_menu_gallery"
        android:layout_gravity="center"
        android:gravity="center"
        android:layout_weight="1"
        />
    <TextView
        android:id="@+id/gall_txt"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:text="Gallery"
        android:drawableLeft="@android:drawable/ic_menu_gallery"
        android:layout_gravity="center"
        android:gravity="center"
        android:layout_weight="1"
        />
    <TextView
        android:id="@+id/menu_add_txt"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:text="Gallery"
        android:drawableLeft="@android:drawable/ic_menu_add"
        android:layout_gravity="center"
        android:gravity="center"
        android:layout_weight="1"
        />

    <TextView
        android:id="@+id/media_txt"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_gravity="center"
        android:layout_weight="1"
        android:drawableLeft="@android:drawable/ic_media_rew"
        android:gravity="center"
        android:text="Gallery" />
    </LinearLayout>

为抽屉创建自定义视图和布局

 <android.support.design.widget.NavigationView
    android:id="@+id/nav_view_left"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:fitsSystemWindows="true"
    app:headerLayout="@layout/nav_header_left" />

nav_header_left.xml

 <?xml version="1.0" encoding="utf-8"?>
  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:background="@color/right_side_header_bg_color"
    android:theme="@style/ThemeOverlay.AppCompat.Dark"
    android:paddingTop="@dimen/fifty"
    android:paddingRight="@dimen/twenty"
    android:paddingLeft="@dimen/twenty"
    android:orientation="vertical"
    android:weightSum="4">

    <TextView
        android:id="@+id/add_txt"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:text="Gallery"
        android:drawableLeft="@android:drawable/ic_menu_gallery"
        android:layout_gravity="center"
        android:gravity="center"
        android:layout_weight="1"
        />
    <TextView
        android:id="@+id/gall_txt"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:text="Gallery"
        android:drawableLeft="@android:drawable/ic_menu_gallery"
        android:layout_gravity="center"
        android:gravity="center"
        android:layout_weight="1"
        />
    <TextView
        android:id="@+id/menu_add_txt"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:text="Gallery"
        android:drawableLeft="@android:drawable/ic_menu_add"
        android:layout_gravity="center"
        android:gravity="center"
        android:layout_weight="1"
        />

    <TextView
        android:id="@+id/media_txt"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_gravity="center"
        android:layout_weight="1"
        android:drawableLeft="@android:drawable/ic_media_rew"
        android:gravity="center"
        android:text="Gallery" />
    </LinearLayout>

将此代码用于导航视图:

<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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start"
android:theme="@style/AppTheme">

<android.support.design.widget.CoordinatorLayout
    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.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/white">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@android:color/white"
            android:titleTextColor="@color/theme_color_dark"
            style="@style/AppTheme"
            android:theme="@style/AppTheme"/>

    </android.support.design.widget.AppBarLayout>

</android.support.design.widget.CoordinatorLayout>
<fragment
    android:id="@+id/menu_fragement"
    android:tag="Menu"
    android:layout_width="250dp"
    android:layout_gravity="start"
    android:name="com.app.medcallz.fragments.MenuFragement"
    android:layout_height="match_parent"
    />
</android.support.v4.widget.DrawerLayout>

菜单碎片:

<LinearLayout
android:id="@+id/options_container"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_below="@+id/user_detail_container">

    <ImageView
        android:id="@+id/notificationsIcon"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/nav_notificatios"
        android:layout_weight="0.1"/>

    <View
        android:id="@+id/account_divider"
        android:layout_width="fill_parent"
        android:layout_height="@dimen/login_divider_width"
        android:background="@color/white_color"
        android:visibility="visible"

        />
</LinearLayout>

将此代码用于导航视图:

<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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start"
android:theme="@style/AppTheme">

<android.support.design.widget.CoordinatorLayout
    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.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/white">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@android:color/white"
            android:titleTextColor="@color/theme_color_dark"
            style="@style/AppTheme"
            android:theme="@style/AppTheme"/>

    </android.support.design.widget.AppBarLayout>

</android.support.design.widget.CoordinatorLayout>
<fragment
    android:id="@+id/menu_fragement"
    android:tag="Menu"
    android:layout_width="250dp"
    android:layout_gravity="start"
    android:name="com.app.medcallz.fragments.MenuFragement"
    android:layout_height="match_parent"
    />
</android.support.v4.widget.DrawerLayout>

菜单碎片:

<LinearLayout
android:id="@+id/options_container"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_below="@+id/user_detail_container">

    <ImageView
        android:id="@+id/notificationsIcon"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/nav_notificatios"
        android:layout_weight="0.1"/>

    <View
        android:id="@+id/account_divider"
        android:layout_width="fill_parent"
        android:layout_height="@dimen/login_divider_width"
        android:background="@color/white_color"
        android:visibility="visible"

        />
</LinearLayout>


似乎不起作用。所有图标都集中在顶部这是我的抽屉布局:“xmlns:app=”“xmlns:tools=”“android:id=“@+id/drawer\u layout”android:layout\u width=“match\u parent”android:layout\u height=“match\u parent”android:fitsystemwindows=“true”tools:openDrawer=“start“>标题布局中的所有图标都被压扁。看起来所有的图标都试图放入该标题中。是的,某些设备未显示抽屉全屏计算并将设备高度添加到nav_header_left.xml根布局以进行全屏显示似乎不起作用。所有图标都集中在顶部这是我的抽屉布局:“xmlns:app=”“xmlns:tools=”“android:id=“@+id/drawer\u layout”android:layout\u width=“match\u parent”android:layout\u height=“match\u parent”android:fitsystemwindows=“true”tools:openDrawer=“start“>标题布局中的所有图标都被压扁。看起来所有的图标都试图放在该标题中。是的,一些设备没有全屏显示。计算并将设备高度添加到nav_header_left.xml到根布局以全屏显示