GithubHelp home page GithubHelp logo

Comments (14)

juiceo avatar juiceo commented on May 7, 2024 1

I managed to get the badges and titles to display by wrapping my NavigationTabBar inside a FrameLayout. Perhaps this is a bug with android or the support libraries? In any case, please add this to the description so other people will know in the future. Thanks for your help!

from navigationtabbar.

GIGAMOLE avatar GIGAMOLE commented on May 7, 2024

Hello. Thanks for detailed issue. You cant show badge if tab have empty badge title. So, when you adf your models just set badge title to each of them and then you can show it.

from navigationtabbar.

juiceo avatar juiceo commented on May 7, 2024

Alright, thanks for the quick response and sorry for failing on inserting the code snippets :)

So in this particular snippet I realize I tried adding a badge to a model with an empty title, but before I tried adding it to the last one (which has a title) and it didn't work. Do I need to add a badge title to all of my models?

from navigationtabbar.

juiceo avatar juiceo commented on May 7, 2024

Here's an updated version of setting the models, which does not work either :(

models.add(
new NavigationTabBar.Model.Builder(browse, getResources().getColor(R.color.theme_accent))
.badgeTitle("1")
.title("Wee")
.build()
);
models.add(
new NavigationTabBar.Model.Builder(create, getResources().getColor(R.color.theme_accent))
.badgeTitle("2")
.title("Wee")
.build()
);
models.add(
new NavigationTabBar.Model.Builder(lists, getResources().getColor(R.color.theme_accent))
.badgeTitle("3")
.title("Wee")
.build()
);
navigationTabBar.setModels(models);
navigationTabBar.setViewPager(viewPager, 0);
navigationTabBar.setIsBadged(true);
navigationTabBar.setBadgeBgColor(Color.RED);
navigationTabBar.setBadgeTitleColor(Color.WHITE);
navigationTabBar.setBadgeSize(10);
navigationTabBar.setTitleSize(10);

from navigationtabbar.

GIGAMOLE avatar GIGAMOLE commented on May 7, 2024

The badges not showed?

from navigationtabbar.

juiceo avatar juiceo commented on May 7, 2024

Nope, they aren't showing. As a side note, with my current setup I didn't get the tab titles to show either.

from navigationtabbar.

GIGAMOLE avatar GIGAMOLE commented on May 7, 2024

Do you call showBadge?

from navigationtabbar.

GIGAMOLE avatar GIGAMOLE commented on May 7, 2024

If badge would have a not empty title there it eneabled to show.

from navigationtabbar.

juiceo avatar juiceo commented on May 7, 2024

I don't really understand, in my code all of the models have titles and badge titles, I am setting the navigation tab bar as titled and badged in the xml and I am setting it badged also in the activity code. No badges are showing and no titles are showing. I will have to switch to another library if this is not resolved soon.

from navigationtabbar.

GIGAMOLE avatar GIGAMOLE commented on May 7, 2024

Thanks. Year there a bug of Android layout system.

from navigationtabbar.

kaustubhbhagwat avatar kaustubhbhagwat commented on May 7, 2024

@lappalj4 cam you share your xml code i am facing the same issue but when i try to wrap NTB inside a FrameLayout my app crashes

`

<RelativeLayout
    android:id="@+id/upperRelativeLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:alpha="1"
    android:background="#F6F6F6"
    android:elevation="3dp">


    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <android.support.v4.view.ViewPager
            android:id="@+id/viewPager"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="bottom">

        </android.support.v4.view.ViewPager>


        <com.gigamole.navigationtabbar.ntb.NavigationTabBar
            android:id="@+id/ntb"
            android:layout_width="match_parent"
            android:layout_height="70dp"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_gravity="bottom"
            android:elevation="16dp"
            app:ntb_active_color="@android:color/black"
            app:ntb_animation_duration="100"
            app:ntb_badge_bg_color="#ffff0000"
            app:ntb_badge_gravity="top"
            app:ntb_badge_position="left"
            app:ntb_badge_size="12sp"
            app:ntb_badge_title_color="#ffffffff"
            app:ntb_badge_use_typeface="true"
            app:ntb_badged="true"
            app:ntb_icon_size_fraction="0.6"
            app:ntb_inactive_color="@android:color/darker_gray"
            app:ntb_scaled="true"
            app:ntb_swiped="true"
            app:ntb_tinted="false"
            app:ntb_title_mode="all"
            app:ntb_title_size="10sp"
            app:ntb_titled="true"
            app:ntb_typeface="fonts/agency.ttf" />

    </FrameLayout>


</RelativeLayout>

`
this is what i am trying

from navigationtabbar.

juiceo avatar juiceo commented on May 7, 2024

@kaustubhbhagwat Here it is:

<FrameLayout
            android:id="@+id/ntb_wrapper"
            android:layout_centerInParent="true"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:clipChildren="false"
            android:clipToPadding="false">

            <com.gigamole.navigationtabbar.ntb.NavigationTabBar
                android:id="@+id/main_ntb"
                android:layout_width="150dp"
                android:layout_height="50dp"
                android:layout_gravity="center"
                app:ntb_corners_radius="25dp"
                app:ntb_animation_duration="200"
                app:ntb_active_color="@color/theme_primary"
                app:ntb_inactive_color="@color/grey"
                app:ntb_badged="true"
                app:ntb_titled="false"
                app:ntb_scaled="false"
                app:ntb_tinted="true"
                app:ntb_badge_position="center"
                app:ntb_badge_gravity="bottom"
                app:ntb_badge_bg_color="@color/theme_accent"
                app:ntb_badge_title_color="#ffffff"
                app:ntb_swiped="true"
                app:ntb_bg_color="@color/transparent"
                app:ntb_badge_size="11dp"/>

        </FrameLayout>

And that is wrapped in a RelativeLayout that contains some other views I have in the toolbar, but they should be nothing relevant for this. Keep in mind that I have not updated the lib / changed the code since I last commented on this issue :)

from navigationtabbar.

kaustubhbhagwat avatar kaustubhbhagwat commented on May 7, 2024

screenshot_20170912-150720
@lappalj4 Hello thanks a lot i can see the badges now but i see a black line on top of the NTB , and it goes away when i remove the FrameLayout.

from navigationtabbar.

juiceo avatar juiceo commented on May 7, 2024

@kaustubhbhagwat can't say why that would be happening, but I think you will be able to get rid of it by adjusting padding, margin and clip settings or just having a fixed height for both the framelayout and the NTB inside

from navigationtabbar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.