效果
依赖
compile 'com.ashokvarma.android:bottom-navigation-bar:1.3.0'
OnCreate中初始化
initBottom(); 认选中0 showFragment(0);
然后具体实现
private void showFragment(int position) { FragmentManager supportFragmentManager = getSupportFragmentManager(); FragmentTransaction transaction = supportFragmentManager.beginTransaction(); transaction.replace(R.id.fl_fragment, FragmentFactory.getFragemt(position)).commit(); } private void initBottom() { numberBadgeItem = new BadgeItem() // .setBorderWidth(4) 边框 .setBackgroundColor(Color.RED) .setText("6"); // .setHideOnSelect(autoHide.isChecked()); 点中后干掉 bntBottom .setActiveColor(R.color.maincolor) .addItem(new BottomNavigationItem(R.drawable.conversation_selected_2, "消息").setBadgeItem(numberBadgeItem)) .addItem(new BottomNavigationItem(R.drawable.contact_selected_2, "联系人")) .addItem(new BottomNavigationItem(R.drawable.plugin_selected_2, "动态")) .setFirstSelectedPosition(0) .initialise(); //监听底部导航 bntBottom.setTabSelectedListener(this); } @Override public void onTabSelected(int position) { //当前切换时候调用 showFragment(position); }
以上所述是小编给大家介绍的Android带气泡的第三方Tab选项卡,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对武林网网站的支持!
新闻热点
疑难解答