相关疑难解决方法(0)

全宽导航抽屉

我想创建一个全宽导航抽屉.设置layout_widthmatch_parenton @+id/left_drawer的宽度约为屏幕空间的80%.这似乎是标准行为.我一定要重写onMeasure()DrawerLayout

我目前的代码:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/black"
        android:id="@+id/mainFragmentContainer">
    </FrameLayout>

    <include
        android:id="@+id/left_drawer"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        layout="@layout/drawer"/>
</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)

谢谢.

android android-layout navigation-drawer drawerlayout

34
推荐指数
5
解决办法
4万
查看次数