Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/212.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 导航抽屉不够宽_Android - Fatal编程技术网

Android 导航抽屉不够宽

Android 导航抽屉不够宽,android,Android,我如何使我的导航抽屉尽可能宽(就像在Gmail应用程序中) 在我的应用程序中,它仅扩展到屏幕的一半以上 activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schema

我如何使我的导航抽屉尽可能宽(就像在Gmail应用程序中)

在我的应用程序中,它仅扩展到屏幕的一半以上

activity_main.xml

<?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"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">

    <android.support.design.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        tools:context="com.example.apple.bookshelf.MainActivity">

        <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"  />

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

        <ListView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/authors_list_view"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />

        <include layout="@layout/content_main" />

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

    <android.support.design.widget.NavigationView
        android:id="@+id/navigation_view"
        android:layout_height="match_parent"
        android:layout_width="wrap_content"
        android:layout_gravity="start"
        app:headerLayout="@layout/nav_header"
        app:menu="@menu/menu_navigation"/>

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

您可以尝试自定义导航抽屉。文件上说

如果预构建的小部件或布局都不能满足您的需要,您可以 创建自己的视图子类


您可以考虑创建导航抽屉,这里提供了几种解决方案,还提供了使用库的可能性,您可以查看源代码,但也可以以经典方式尝试,扩展所需的类并覆盖要更改的方法。您可以尝试自定义导航抽屉。文件上说

如果预构建的小部件或布局都不能满足您的需要,您可以 创建自己的视图子类


您可以考虑创建导航抽屉,这里提供了几种解决方案,还提供了使用库的可能性,您可以查看源代码,但也可以尝试传统方式,扩展您需要的类并覆盖您想要更改的方法

在您的应用程序中它看起来像什么?与上面相同,但没有那么广泛。它的宽度刚好超过屏幕的一半。根据官方规格,这是大小应该是
最大宽度:导航抽屉的最大宽度在手机上是280dp,在平板电脑上是320dp。这是通过将标准增量乘以5来计算的(移动设备上的标准增量为56dp,平板电脑上的标准增量为64dp)。
因此设置width i在NavigationView上更改了
android:layout\u width=“280dp”
,但它没有做任何事情IRC您更改抽屉布局宽度在应用程序中是什么样子的?同上,但是没有那么宽。它的宽度刚好超过屏幕的一半。根据官方规格,这是大小应该是
最大宽度:导航抽屉的最大宽度在手机上是280dp,在平板电脑上是320dp。这是通过将标准增量乘以5(移动设备上的标准增量为56dp,平板电脑上的标准增量为64dp)来计算的。
因此设置width i在NavigationView上更改了