如何在Android(材质设计)中使用导航抽屉进行滚动活动 [英] How to get a Scrolling Activity With Navigation Drawer in Android (Material Design)

查看:66
本文介绍了如何在Android(材质设计)中使用导航抽屉进行滚动活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直对材质设计感兴趣,想为我的应用程序主页构建一个布局,使其看起来像Scrolling Activity的默认模板,但也有一个Navigation Drawer,类似于Navigation Drawer Activity的默认模板.轻松导航.

I've been interested in material design and wanted to build a layout for the main page of my app so that it looks like the default template for Scrolling Activity but also has a Navigation Drawer like the default template for Navigation Drawer Activity for easy navigation.

例如,Google的Play音乐应用已经完成了这种事情. 看看:

As an example, Google's Play Music app already does this sort of thing. Have a look:

滚动列表,顶部带有横幅和FAB

导航抽屉,可以从上方向左滑动

我到处搜索,可以找到实现这种布局的直接方法.因此,我尝试自己进行操作,并在Scrolling Activity和Navigation Drawer Activity的默认模板中进行了一些更改,使我能够实现这些目标,但并没有达到我想要的目的.

I've searched everywhere and could find a direct way for implementing such a layout. So I tried doing it on my own and with some changes here and there in the default templates of Scrolling Activity and the Navigation Drawer Activity I was able to achieve something along those lines but not exactly what I was looking for.

我希望有人可以提出一种更好的方法.

I was hopping if someone could present a better way of doing it.

推荐答案

我已经完全想要了,您只需要在Navigation Drawer Activity的布局中包含Scrolling Activity的布局即可,并且效果很好.

I've got exactly what I wanted, you simply need to include Scrolling Activity's layout inside the layout of Navigation Drawer Activity and it works nicely.

您可以使用Android Studio中提供的用于这些活动的默认模板来节省一些时间或从头开始.

You can use the default templates for these activities given in the Android Studio to save yourself some time or start from scratch.

让我知道是否有人需要一些代码,我很乐意将其发布:)

Let me know if anyone needs some code and I will be more than happy to post it :)

这篇关于如何在Android(材质设计)中使用导航抽屉进行滚动活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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