简体   繁体   English

Android-导航抽屉的替代品

[英]Android - Alternatives to Navigation Drawer

I am trying to implement something similar to a Navigation Drawer, but not so complicated: 我正在尝试实现类似于导航抽屉的方法,但并不那么复杂:

侧栏关闭侧边栏打开

What would be the best way to do it? 最好的方法是什么? I have looked into using the Android Navigation Drawer, but it seems much too complicated for my needs. 我已经研究过使用Android导航抽屉,但是对于我的需求来说似乎太复杂了。 Also, not so customizable. 而且,不是那么可定制的。

The obvious guess would be to use a hidden layout that gradually shows up while the user drags towards the right. 显而易见的猜测是使用一种隐藏布局,当用户向右拖动时逐渐显示出来。 I am, however, looking for a library / easy and reliable solution. 但是,我正在寻找一个图书馆/简单可靠的解决方案。

As a suggestion, 作为建议,

Using library (if you found one) just for visible/hide a portion of layout is not something good. 使用库(如果找到了一个库)只是为了可见/隐藏部分布局是不好的。 So you have basically two options. 因此,您基本上有两个选择。

  1. you can create two static fragments (one for menu, one for larger screen) and hide/visible menu fragment when you need. 您可以创建两个静态片段(一个用于菜单,一个用于较大的屏幕),并在需要时隐藏/显示菜单片段。 You may need to set the layout width at run-time. 您可能需要在运行时设置布局宽度。

  2. Define a drawer(though you do not like that), but it would be the most easy to handle and reliable way to achieve your requirement. 定义一个抽屉(尽管您不喜欢这样),但这将是最容易处理且最可靠的方式来满足您的需求。 You just need simple listview and a drawer. 您只需要简单的listview和一个抽屉。

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

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