BottomTabBar的使用
来源:互联网 发布:人工智能接口 编辑:程序博客网 时间:2024/06/07 15:50
最快制作页面底部的四个RadioButto
(1)先将compile 'com.hjm:BottomTabBar:1.1.1' 导入build.gradle。
在布局文件里面导入<com.hjm.bottomtabbar.BottomTabBar>把宽高全部都为充满。在创建一个布局fragment方便后面进行使用,里面什么都不用写。
(2)在主类里面创建一个方法init(),
将下面代码直接粘贴,复制
bottomTabBar = (BottomTabBar) findViewById(R.id.bottomTabBar);
//底部导航栏
bottomTabBar.init(getSupportFragmentManager())
.setImgSize(35, 35)
.setFontSize(10)
.setChangeColor(Color.RED, Color.GRAY)
.addTabItem("首页", R.mipmap.ic_nav_home_press, R.mipmap.ic_nav_home, Fragment1.class) 前面第一个是点击后的图片,第二个是点击前的图片
.addTabItem("分类", R.mipmap.ic_nav_class_press, R.mipmap.ic_nav_class, Fragment2.class)
.addTabItem("购物车", R.mipmap.ic_nav_cart_press, R.mipmap.ic_nav_cart, Fragment3.class)
.addTabItem("个人", R.mipmap.ic_nav_user_press, R.mipmap.ic_nav_user, Fragment4.class)
.isShowDivider(false);
最后创建4个fragment,在frangment重写onCreateView的方法,(特别注意导包一定要导android.support.v4.app.Fragment)
View view=inflater.inflate(R.layout.fragment,container,false);
return view;
阅读全文
0 0
- BottomTabBar的使用
- bottomTabBar的使用
- Android BottomTabBar的简单使用
- BottomTabBar使用
- BottomTabBar使用
- BottomTabBar简单使用
- Android BottomTabBar控件的使用 Fragment 页面切换
- BottomTabBar的底部栏
- BottomTabBar
- BottomTabBar
- BottomTabBar
- android 封装好的BottomTabBar
- android 封装好的BottomTabBar
- android BottomTabBar的简单使用(类似:京东底部导航栏)
- Android--------使用BottomTabBar实现底部导航页
- 使用BottomTabBar实现底部导航页
- Android--使用BottomTabBar实现底部导航页
- 使用BottomTabBar实现类似Fragment页面切换
- NOIP-2014 联合权值
- BZOJ3398 [Usaco2009 Feb]Bullcow 牡牛和牝牛
- MySQL双主一致性架构优化
- HDU
- 编程范式13听课笔记——缓冲区溢出和C++接受可变参数
- BottomTabBar的使用
- Can not drop UNDOSTBS
- BZOJ1054 移动玩具 BFS+hash
- angularjs购物车全选反选
- 取消chrome浏览器下input和textarea的默认样式
- label的作用是什么?是怎么用的?
- 如何一句话惹毛程序员
- Recvclerview上拉加载
- 阿里云搭建基于PPTP的VPN(Windows Server 2008)