Gmail类似于xamarin.forms中的导航抽屉(母版页) [英] Gmail like navigation drawer (master page) in xamarin.forms

查看:203
本文介绍了Gmail类似于xamarin.forms中的导航抽屉(母版页)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用MVVMlight在xamarin.forms中使用母版详细信息页面,并且它根据os的默认行为进行渲染,可以完美呈现我想要的内容,但是在android母版页面中,导航栏下方开始.我希望母版页能够像ios一样覆盖整个屏幕高度,是否有没有自定义渲染器的方法或解决方案,或者是否有必要为此编写自定义渲染器

I am currently using the master-detail page in xamarin.forms using MVVMlight and it renders based on the default behavior of os it renders perfectly what I wanted but in android master page starts below the navigation bar. I wanted master page to cover full height of screen just like ios do so is there any way or solution for it without custom renderer or is it necessary to write custom renderer for this

推荐答案

使用FormsAppCompatActivity而不是FormsApplicationActivity.

Use FormsAppCompatActivity instead of FormsApplicationActivity.

定义您自己的toolbar.axml

define your own toolbar.axml

toolbar.axml

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:minHeight="?attr/actionBarSize"
    android:contentInsetStart="0dp"
    android:contentInsetLeft="0dp"
    app:contentInsetLeft="0dp"
    app:contentInsetStart="0dp"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    app:layout_scrollFlags="scroll|enterAlways">
</android.support.v7.widget.Toolbar>

设置自己的 ToolbarResource

public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
        protected override void OnCreate(Bundle bundle)
        {
            ToolbarResource = Resource.Layout.toolbar;
            base.OnCreate(bundle);
            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());
        }
    }

这篇关于Gmail类似于xamarin.forms中的导航抽屉(母版页)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆