欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

Android带气泡的第三方Tab选项卡

程序员文章站 2023-12-20 15:42:40
效果 依赖 compile 'com.ashokvarma.android:bottom-navigation-bar:1.3.0' oncreat...

效果

Android带气泡的第三方Tab选项卡

依赖

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选项卡,希望对大家有所帮助

上一篇:

下一篇: