小编Shr*_*ant的帖子

全屏导航抽屉

我有一个抽屉式导航栏中像这样.

我想要做的是打开我的抽屉全屏而不是半屏.如何将此抽屉打开为全屏?

这是xml of drawerlayout

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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">

<include
    android:id="@+id/toolbar_layout"
    layout="@layout/app_toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

<android.support.v4.widget.DrawerLayout
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@id/toolbar_layout"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">

    <FrameLayout
        android:id="@+id/activityMainContent"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    <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:background="@color/colorPrimary"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header_main"
        app:itemTextColor="@android:color/white"
        app:menu="@menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

android navigation-drawer drawerlayout

8
推荐指数
1
解决办法
1万
查看次数

Kotlin编程基础知识

我正在努力学习Kotlin,我在使用函数时遇到了一个问题.

fun main(args: Array<String>) {
    println(max(20, 10))
}

fun max(a: Int, b: Int) = if (a > b) a else b
Run Code Online (Sandbox Code Playgroud)

这里我有一个函数MAX.现在上面的实现和函数MAX的下面的实现有什么区别,虽然两者都给出相同的输出.

fun max(a: Int, b: Int): Int?{
    if(a > b)
        return a
    else
        return b
}
Run Code Online (Sandbox Code Playgroud)

kotlin

0
推荐指数
1
解决办法
158
查看次数

标签 统计

android ×1

drawerlayout ×1

kotlin ×1

navigation-drawer ×1