Devlight / NavigationTabBar

Navigation tab bar with colorful interactions.
Apache License 2.0
4.95k stars 858 forks source link

Why no title? #113

Open Leo4Truth opened 6 years ago

Leo4Truth commented 6 years ago

I have tried to set both in layout file(xml) or activity file(java), but the title I set never show.

activity_main.xml <devlight.io.library.ntb.NavigationTabBar android:id="@+id/navigationTabBar" android:layout_width="match_parent" android:layout_height="50dp" android:layout_alignParentBottom="true" app:ntb_animation_duration="400" app:ntb_preview_colors="@color/orange" app:ntb_active_color="#fff" app:ntb_inactive_color="#fe3" app:ntb_badged="true" app:ntb_titled="true" app:ntb_scaled="true" app:ntb_title_mode="all" app:ntb_badge_position="center" app:ntb_badge_gravity="top" app:ntb_badge_bg_color="#24e3f5" app:ntb_badge_title_color="#000000" app:ntb_badge_use_typeface="true" app:ntb_typeface="fonts/xiyuan.TTF" app:ntb_swiped="true" app:ntb_bg_color="@color/orange" app:ntb_icon_size_fraction="0.5" app:ntb_badge_size="10sp" app:ntb_title_size="10sp" />

MainActivity.java in onCreate() navigationTabBar = (NavigationTabBar) findViewById(R.id.navigationTabBar); models = new ArrayList<>(); models.add( new NavigationTabBar.Model.Builder( getResources().getDrawable(R.mipmap.gift), Color.parseColor("#aaffbb") ).title("账本").badgeTitle("aaaa").build() ); models.add( new NavigationTabBar.Model.Builder( getResources().getDrawable(R.mipmap.clothing), Color.parseColor("#785355") ).title("明细").badgeTitle("bbbb").build() ); models.add( new NavigationTabBar.Model.Builder( getResources().getDrawable(R.mipmap.shopping), Color.parseColor("#214542") ).title("统计").badgeTitle("cccc").build() ); models.add( new NavigationTabBar.Model.Builder( getResources().getDrawable(R.mipmap.eating), Color.parseColor("#123456") ).title("设置").badgeTitle("dddd").build() ); navigationTabBar.setModels(models); navigationTabBar.setTitleMode(NavigationTabBar.TitleMode.ALL); navigationTabBar.setBadgeGravity(NavigationTabBar.BadgeGravity.TOP); navigationTabBar.setBadgePosition(NavigationTabBar.BadgePosition.CENTER); navigationTabBar.setTitleSize(30); navigationTabBar.setIsTitled(true);

api 26 What should I do to make it show title? thx!

adapana commented 6 years ago

same problem. any solution?

AlexLiuSheng commented 6 years ago

same

Liujiangsong commented 6 years ago

same

xerdink commented 6 years ago

Did you try ?

models.get(index).showBadge();
sootood commented 5 years ago

i have same problem any one solved?

Metilar commented 5 years ago

There was a similar problem, NavigationTabBar was inside RelativeLayout, looked at an example, changed it to LinearLayout, and the titles worked.