简体   繁体   English

适用于下Api的Android材质设计导航抽屉

[英]Android Material Design Navigation Drawer for Lower Api

Is it possible to make a Navigation Drawer in Material Design like the Gmail app on lower API? 是否可以在Material Design中制作导航抽屉,例如在较低API上的Gmail应用程序? If it's possible have anyone a Tutorial or a guide to do this? 是否有可能有人提供教程或指南? Thanks 谢谢

Use Appcompat library for it, here's a link how to set it up: http://android-developers.blogspot.in/2014/10/appcompat-v21-material-design-for-pre.html 为此使用Appcompat库,以下是如何设置的链接: http : //android-developers.blogspot.in/2014/10/appcompat-v21-material-design-for-pre.html

You need to use the Toolbar to show the arrowToggle: 您需要使用工具栏来显示arrowToggle:

<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"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>

And in your mainView you need to add this: 并且在您的mainView中,您需要添加以下内容:

setContentView(R.layout.guidelib_activity_main);
mToolbar = (Toolbar)findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);

Also refer this question: Appcompat Toolbar Not Showing With Navigation Drawer 另请参阅此问题: Appcompat工具栏不与导航抽屉一起显示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM