分享活动的菜单栏 [英] Sharing menu bar between activities

查看:108
本文介绍了分享活动的菜单栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的应用程序菜单栏,我需要在5我的活动分享。我的菜单栏(= 5按钮允许活动之间进行切换)已经完全一样的UI和任何活动相同的行为,所以我想跟大家分享两个菜单栏XML视图code和控制器code

I have a menu bar on my app, that I need to share between 5 of my activities. My menu bar (= 5 buttons allowing to switch between activities) has exactly the same UI and the same behavior for any activity so I would like to share both menu bar XML view code and controller code.

我已经找到了一种方法来共享XML code。使用可重复使用的UI组件但我不能找到一个方法来共享控制器code控制菜单栏按钮点击。

I already found a way to share the XML code using Reusable UI Components but I can't find a way to share the controller code that controls the menu bar buttons clicks.

注:我的菜单栏是定做的,而不是Android的选项菜单之一。

Note: my menu bar is a custom-made one, not the Android Options Menu one.

在此先感谢。

推荐答案

我认为最好的解决办法是使用的片段中,使用支持Android V4库

I think the best solution is to use Fragments, using the Android Support v4 library

这篇关于分享活动的菜单栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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