所有活动中都使用相同的 SlideDrawer 吗?
我的应用程序中有一个 slidingDrawer
,其中包含所有活动都应访问的链接。是否可以创建一个 slidingDrawer
并将其扩展到所有活动?任何例子都会非常有帮助。
I have a slidingDrawer
in my application that contains links which should be accessed by all activities. Is it possible to create a single slidingDrawer
and extend it to all activities? Any example would be very helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为最好的选择是创建一个包含所有滑动抽屉逻辑的父类。父类将扩展活动并确保设置/填充您的滑动抽屉,数据可能是单例也以避免加载重复。然后你的所有活动都会扩展你的 SlidingDrawer 活动并做他们的事情。
I think your best bet would be to create a parent class with all of the sliding drawer logic. The parent class would extend activity and make sure to setup / populate your sliding drawer, the data could possibly be a singleton also to avoid load duplication. Then all of your activities would extend your SlidingDrawer activity and do their thing.