akshay2211 / BubbleTabBar

BubbleTabBar is a bottom navigation bar with customizable bubble-like tabs

Home Page:https://github.com/akshay2211/BubbleTabBar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Customize MenuItem title.

ionate12 opened this issue · comments

Hi akshay2211,
Thanks you for providing me a great library. I love using it!

However, it restricts me to customize the MenuItem titles. I found no way to modify it.

I would appreciate if you could guide me how to change, or maybe improve it in latter version.

Regards,

Hello @ionate12
Thanks for using BubbleTabBar
I will later integrate this functionality to modify titles dynamically, for now, you can use this code

(((bubbleTabBar.getChildAt(0) as Bubble).getChildAt(0) as LinearLayoutCompat).getChildAt(1) as AppCompatTextView).setText("Hello")
it will modify the first tab title to "Hello".

Thanks @akshay2211,
This piece of code works well.
Only when changing the text in an active MenuItem, you might have to call "isSelected = true" to let it recalculate the length of the text.
(((bubbleTabBar.getChildAt(0) as Bubble).getChildAt(0) as LinearLayoutCompat).getChildAt(1) as AppCompatTextView).setText("Hello")

(bubbleTabBar.getChildAt(0) as Bubble).isSelected = true /*Invoke title.expand(container, item.iconColor) once again*/

How can i change the text color of item

Hello @fsfaysalcse
just add the desired color like below in iconTint
<item android:id="@+id/home" android:icon="@drawable/ic_grid" android:title="Home" android:checked="true" android:iconTint="@color/home"/>

@akshay2211 is there any dynamic way available to modify icon tint color programmatically instead of menu xml?