Android--------使用BottomTabBar实现底部导航页
来源:互联网 发布:板式家具设计软件 编辑:程序博客网 时间:2024/06/01 19:31
注:详细见链接
http://www.jianshu.com/p/ade8485a16be
1.导依赖
compile 'com.hjm:BottomTabBar:1.1.1'
2.在XML中定义一下该控件
<com.hjm.bottomtabbar.BottomTabBar android:id="@+id/bottom_tab_bar" android:layout_width="match_parent" android:layout_height="match_parent" ></com.hjm.bottomtabbar.BottomTabBar>
3.定义每个Fragment,这里列举一个
public class OneFragment extends Fragment{ @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment1, container, false); return view; }}
4.MainActivity中
public class MainActivity extends AppCompatActivity {private BottomTabBar mb; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mb=(BottomTabBar)findViewById(R.id.bottom_tab_bar); mb.init(getSupportFragmentManager()) .setImgSize(50,50) .setFontSize(8) .setTabPadding(4,6,10) .setChangeColor(Color.RED,Color.DKGRAY) .addTabItem("月光茶人",R.drawable.tab_home, OneFragment.class) .addTabItem("优惠",R.drawable.tab_topic, TwoFragment.class) .addTabItem("购物车",R.drawable.main_index_cart_normal, ThreeFragment.class) .addTabItem("我的",R.drawable.main_index_my_normal, FourFragment.class) .isShowDivider(false) .setOnTabChangeListener(new BottomTabBar.OnTabChangeListener() { @Override public void onTabChange(int position, String name) { } }); }}
阅读全文
0 0
- Android--------使用BottomTabBar实现底部导航页
- Android--使用BottomTabBar实现底部导航页
- Android--------使用BottomTabBar实现底部导航页
- Android--------使用BottomTabBar实现底部导航页
- Android---使用BottomTabBar实现底部导航页
- Android--------使用BottomTabBar实现底部导航页
- 使用BottomTabBar实现底部导航页
- 使用BottomTabBar+Fragment实现底部导航页
- BottomTabBar实现底部导航页
- BottomTabBar底部导航页
- BottomTabBar实现底部导航栏
- Android——BottomTabBar实现底部导航栏
- 使用BottomTabBar实现底部导航,MVP网络框架,retrofit解析
- 底部导航栏 BottomTabBar
- BottomTabBar底部导航模版
- android BottomTabBar的简单使用(类似:京东底部导航栏)
- //BottomTabBar实现底部选项卡
- 底部导航:BottomTabBar的简单应用
- angularJS项目
- 将本地的静态页面发布,没服务器怎么发布?
- dataset兼容低版本IE的方法
- Twitter SDE 波士顿电面面经
- 【LeetCode】687.Longest Univalue Path(Easy)解题报告
- Android--------使用BottomTabBar实现底部导航页
- C++中cin的详细用法
- uC/OS-III文件结构
- jeesite中集成Swagger2 三步
- 产品测试工装的研发回忆录
- java性能优化笔记(三)java程序优化
- webstorm 2017 激活破解
- Spring MVC 和 Spring 总结
- linux和c的行分隔符