教你轻松几步实现底部导航栏_Android, Python及开发编程讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  Android, Python及开发编程讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 1638 | 回复: 0   主题: 教你轻松几步实现底部导航栏        下一篇 
xiaoyang
注册用户
等级:上士
经验:253
发帖:75
精华:0
注册:2011-10-19
状态:离线
发送短消息息给xiaoyang 加好友    发送短消息息给xiaoyang 发消息
发表于: IP:您无权察看 2015-12-22 14:59:04 | [全部帖] [楼主帖] 楼主

现在市场上很多app都喜欢底部导航的样式,当然底部导航有很多种方法实现:Fragment、Tabhost等等。最近在网上看到一个比较容易实现的一种方法,真的很

简单,下面给大家分享一下:

1.首先导入一个第三方的包:activitycollection.jar(见下)
2.让你的MainActivity继承ActivityCollection
 

   protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_main);  要将这句注释掉
        setBottomTabBackground(R.drawable.bottombanner);
//        setDrawableCollections();
    }
@Override
        protected List<IndicatorInfo> setDrawableCollections() {
                // TODO Auto-generated method stub
                List<IndicatorInfo> indicatorInfos = new ArrayList<IndicatorInfo>();
                IndicatorInfo info1 = new IndicatorInfo(R.drawable.icon_1_n, R.drawable.icon_1_c, 
                R.string.home, 12, color.white,new Intent(this,FirstActivity.class));
                IndicatorInfo info2 = new IndicatorInfo(R.drawable.icon_3_n, R.drawable.icon_3_c, 
                R.string.search, 12, color.white,new Intent(this,SecondActivity.class));
                IndicatorInfo info3 = new IndicatorInfo(R.drawable.icon_4_n, R.drawable.icon_4_c, R.string.con, 
                12, color.white,new Intent(this,ThirdActivity.class));
                
                indicatorInfos.add(info1);
                indicatorInfos.add(info2);
                indicatorInfos.add(info3);
                return indicatorInfos;

1.png



2.png




3.png



怎么样是不是很简单的,这样的话可以节省很多空间去让你开发逻辑,而且非常简单哦。

















赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论