Android 使用 MaterialDrawer(Library) 和 FlowingDrawer(Library)
Android Use MaterialDrawer(Library) with FlowingDrawer(Library)
在我们开始之前,最好看一下这两个库
材质抽屉 - https://github.com/mikepenz/MaterialDrawer
流动抽屉 - https://github.com/mxn21/FlowingDrawer
我目前正在使用 MaterialDrawer。
允许我超快速的抽屉实现、维护等..
出于这个原因我不能放弃这个库,但我仍然喜欢使用提供超酷抽屉效果的 FlowingDrawer。
我想到了 2 个可能的选项。
- 从 MaterialDrawer 中导出视图,将其插入到 FlowingDrawer 中。
- 正在编辑 MaterialDrawer 的代码以供 FlowingDrawer 实现。
我什至不确定这两个建议是否可行。
告诉我你的想法!如果解决方案更好。
MaterialDrawer 需要 DrawerLayout
。 FlowingDrawer 没有实现 DrawerLayout
因此这是不可能的。修改 MaterialDrawer
的代码听起来像是一项巨大的工作,因为 DrawerLayout
的方法和功能在许多不同的地方使用。
我的建议是使用 MaterialDrawer
生成的 View
。看一下 EmbeddedDrawerActivity
实际上就是这样做的。它创建 MaterialDrawer
然后使用它的 View
并将其添加到根。
result = new DrawerBuilder()
.withActivity(this)
.withToolbar(toolbar)
.withTranslucentStatusBar(false)
.withAccountHeader(headerResult)
.addDrawerItems(
...
)
.withSavedInstance(savedInstanceState)
.buildView();
View drawerView = result.getSlider();
在我们开始之前,最好看一下这两个库
材质抽屉 - https://github.com/mikepenz/MaterialDrawer
流动抽屉 - https://github.com/mxn21/FlowingDrawer
我目前正在使用 MaterialDrawer。 允许我超快速的抽屉实现、维护等..
出于这个原因我不能放弃这个库,但我仍然喜欢使用提供超酷抽屉效果的 FlowingDrawer。
我想到了 2 个可能的选项。
- 从 MaterialDrawer 中导出视图,将其插入到 FlowingDrawer 中。
- 正在编辑 MaterialDrawer 的代码以供 FlowingDrawer 实现。
我什至不确定这两个建议是否可行。
告诉我你的想法!如果解决方案更好。
MaterialDrawer 需要 DrawerLayout
。 FlowingDrawer 没有实现 DrawerLayout
因此这是不可能的。修改 MaterialDrawer
的代码听起来像是一项巨大的工作,因为 DrawerLayout
的方法和功能在许多不同的地方使用。
我的建议是使用 MaterialDrawer
生成的 View
。看一下 EmbeddedDrawerActivity
实际上就是这样做的。它创建 MaterialDrawer
然后使用它的 View
并将其添加到根。
result = new DrawerBuilder()
.withActivity(this)
.withToolbar(toolbar)
.withTranslucentStatusBar(false)
.withAccountHeader(headerResult)
.addDrawerItems(
...
)
.withSavedInstance(savedInstanceState)
.buildView();
View drawerView = result.getSlider();