Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于类似自定义抽屉式菜单或者底部菜单的多个顶层导航的功能无法实现 #52

Open
AnthonyCoder opened this issue Aug 17, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@AnthonyCoder
Copy link

从Navigation过来的,项目迁移,遇到一个问题,关于自定义的抽屉菜单无法配合使用多顶层导航实现Fragment之间的管理
见:官方的抽屉式多顶层导航实现示例代码

起因是这样,因为项目使用了自定义布局的抽屉式写法类似(利用DrawerLayout实现自定义左右抽屉布局)

但是这样在放弃使用官方样式的同时也抛弃了NavigationView的使用和menu相关的配置
所以没办法通过Navigation去实现同时多个顶层导航,
然后看了下fragivity的示例代码,
发现在Activity中去通过loadRoot()方法设置好像也只可能有一个顶层导航,
所以希望大佬看看有没有实现的可能,
如果有的话,可以麻烦在代码中加上相关示例吗?
因为我认为这是一个强需求

@AnthonyCoder
Copy link
Author

另外,这个开源库很棒,作者大大加了不少常用且通用的扩展函数,从使用上来说相比Navigation,代码量精简了不少!

@qdsfdhvh
Copy link
Collaborator

多返回栈吗,新版navigation是支持了,前段时间尝试适配了下(feature/multi-back分支),但是还没实现生命周期走到onStart/onStop,不太好弄。
不是多返回栈的话,建议用viewpager2。

@AnthonyCoder
Copy link
Author

是的,但是官方的example都是基于他自己的组件,比如抽屉菜单需要NavigationView和menu文件绑定,底部菜单BottomNavigation和menu绑定.
那如果我不是用官方的UI组件,比如我想要自定义一些组件就没办法实现多返回栈了.

@qdsfdhvh
Copy link
Collaborator

可以参照官方来适配自定义组件,虽然实现的代码不会很好看但是应该能实现;

后面会尝试增加loadMultiRoot(),就是不怎么好实现,加上最近工作上也比较忙,可能会要些时间。

@qdsfdhvh qdsfdhvh added the enhancement New feature or request label Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants