简体   繁体   English

如何以编程方式从底部栏隐藏项目

[英]How to hide Items from bottom bar programmatically

I am adding bottom bar using This Library . 我正在使用This Library添加底部栏。 I want to user can enable disable item by filter which tab should be show or hide. 我希望用户可以按过滤器启用禁用项,该选项卡应显示或隐藏。 but i can't able to hide the items programmatically. 但我无法以编程方式隐藏项目。 is there any way to hide the tabs programmatically. 有什么办法以编程方式隐藏选项卡。

TABS TABS

<?xml version="1.0" encoding="utf-8"?>
<tabs>
<tab
    id="@+id/facebook"
    icon="@drawable/ic_facebook_logo"
    title="facebook"
    inActiveColor="#ffffff"
    barColorWhenSelected="#3b5998"
    activeColor="#ffffff"
    />
<tab
    id="@+id/googleplus"
    icon="@drawable/ic_google"
    title="google+"
    inActiveColor="#ffffff"
    activeColor="#ffffff"
    barColorWhenSelected="#dd4b39"/>
<tab
    id="@+id/twitter"
    icon="@drawable/ic_twitter_social"
    title="twitter"
    barColorWhenSelected="#00aced"
    inActiveColor="#ffffff"

    activeColor="#ffffff"
    />
<tab
    id="@+id/instagram"
    icon="@drawable/ic_instagram_social"
    title="instagram"
    inActiveColor="#ffffff"

    activeColor="#ffffff"
    barColorWhenSelected="#cd486b"/>
<tab
    id="@+id/linkedin"
    icon="@drawable/ic_linkedin_logo"
    title="linkedin"
    inActiveColor="#ffffff"
    barColorWhenSelected="#0077b5"
    activeColor="#ffffff"
    />
</tabs>

XML XML格式

<com.roughike.bottombar.BottomBar
        android:id="@+id/bottomBar"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_gravity="bottom"
        app:bb_tabXmlResource="@xml/tabs"
        app:bb_behavior="shy"
        app:bb_activeTabAlpha="1"
        app:bb_showShadow="true"
        />

你不能做

bottomBar.getTabAtPosition(x).setVisibility(View.GONE);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM