question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot get badges to show

See original GitHub issue

Hi,

Otherwise the NTB works like a charm, but I can’t get the badges to show at all…

Here’s my layout xml: `<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_container" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">

<com.gigamole.navigationtabbar.ntb.NavigationTabBar
    android:id="@+id/main_ntb"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_alignParentTop="true"
    app:ntb_animation_duration="200"
    app:ntb_active_color="#ffffff"
    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="right"
    app:ntb_badge_gravity="bottom"
    app:ntb_badge_bg_color="@color/theme_red"
    app:ntb_badge_title_color="#ffffff"
    app:ntb_swiped="true"
    app:ntb_bg_color="@color/dark_grey"
    app:ntb_badge_size="10sp"
    app:ntb_title_size="10sp" />

<io.altru.lack.components.NonSwipeableViewPager
    android:id="@+id/viewpager"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_below="@+id/main_ntb"
    android:layout_alignParentBottom="true"
    android:background="@color/lightgrey" />

</RelativeLayout>`

Here’s the code for setting up my NTB:

navigationTabBar = (NavigationTabBar) findViewById(R.id.main_ntb);

final ArrayList<NavigationTabBar.Model> models = new ArrayList<>();

IconDrawable browse = new IconDrawable(this, TypiconsIcons.typcn_home_outline).sizeDp(40);

IconDrawable create = new IconDrawable(this, TypiconsIcons.typcn_camera).sizeDp(40);

IconDrawable lists = new IconDrawable(this, TypiconsIcons.typcn_pin).sizeDp(40);

models.add( new NavigationTabBar.Model.Builder(browse, getResources().getColor(R.color.theme_accent)) .build() );

models.add( new NavigationTabBar.Model.Builder(create, getResources().getColor(R.color.theme_accent)) .build() );

models.add( new NavigationTabBar.Model.Builder(lists, getResources().getColor(R.color.theme_accent)) .badgeTitle(“Wee”) .build() );

navigationTabBar.setModels(models);

navigationTabBar.setViewPager(viewPager, 0);

navigationTabBar.setIsBadged(true);

And finally, here’s the code where I try to show the badge (pretty much copied from the sample app):

navigationTabBar.postDelayed(new Runnable() { @Override public void run() { final NavigationTabBar.Model model = navigationTabBar.getModels().get(0); Log.v(TAG, "Is badge showing before: " + model.isBadgeShowed()); model.showBadge(); Log.v(TAG, "Is badge showing after: " + model.isBadgeShowed()); } }, 500);

In the last code snippet, the model.isBadgeShowed() returns false on both calls, both before and after calling model.showBadge()

Any help?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
juiceocommented, Jul 17, 2016

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!

0reactions
juiceocommented, Sep 12, 2017

@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

Read more comments on GitHub >

github_iconTop Results From Across the Web

What to do if Badge is not Shown on Messages app for New ...
In other words, if App notifications is disabled alarm will not alerted when new message is detected. Launch Settings app > Apps >...
Read more >
Badges not showing - Apple Support Communities
I have a problem with badges, which are not showing at some apps. iOS 15, iPhone 13pro. I receive notifications in centre, but...
Read more >
iPhone Badges Are Not Working - Techwalla
The most likely reason that your iPhone badges don't appear to be working relates to notification settings. If you have turned off the...
Read more >
Troubleshooting the Badge Count - Things Support
Go to System Settings → Notifications. · Find Things in the list of apps. · Toggle on Allow Notifications (if it's on, turn...
Read more >
Enable Notification Badges | Spark Help Center
Select Preferences > Notifications > Badges. Tick Enable dock icon badge; Select one of the options in the Dock count section. To see...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found