0

after updating 28.0.0 i removed item.setShiftingMode(false); then i added this app:labelVisibilityMode="labeled" to xml.

But icon showing correct but label is cut off long text showing only half

example enter image description here

performance cut off please give me suggestion thank you for your advance.

Uthaya
  • 363
  • 2
  • 15
  • Try to update your code from [this link](https://stackoverflow.com/questions/40176244/how-to-disable-bottomnavigationview-shift-mode) – Shreya Prajapati Nov 29 '18 at 06:46
  • this already updated 28.0.0 now only issue is long text cut off – Uthaya Nov 29 '18 at 06:54
  • Yes. Now item.setShifting(false) is availabel instead of item.setShiftingMode(false) – Shreya Prajapati Nov 29 '18 at 07:19
  • I found issue is already registered android officially due to extra padding they resolving i think below i post one way is working for me thank you so much for your response. – Uthaya Nov 29 '18 at 07:40

2 Answers2

1

Hi Guys I found the solution to change the size of the text but its working i'm not sure this is correct way. Any way my issue has been resolved now follow my example really its working. Add your style.xml file these lines:

 <style name="BottomNavigationView">
    <item name="itemTextAppearanceActive">@style/TextAppearance.BottomNavigationView.Active</item>
    <item name="itemTextAppearanceInactive">@style/TextAppearance.BottomNavigationView.Inactive</item>
</style>
<style name="TextAppearance"/>
<style name="TextAppearance.BottomNavigationView"/>
<style name="TextAppearance.BottomNavigationView.Inactive">
    <item name="android:textSize">12sp</item>
</style>
<style name="TextAppearance.BottomNavigationView.Active">
    <item name="android:textSize">11sp</item>
</style>

Then add this line your Bottom Navigation view:

style="@style/BottomNavigationView"

That's all really its working enter image description here

Uthaya
  • 363
  • 2
  • 15
0

Apparantly, this issue has been registered and is being tracked here and is due to unnecessary padding, as a workaround you can use below code to remove padding.

BottomNavigationMenuView menuView = (BottomNavigationMenuView) bottomNavigationView.getChildAt(0);   
 for (int i = 0; i < menuView.getChildCount(); i++) {
        BottomNavigationItemView item = (BottomNavigationItemView) menuView.getChildAt(i);
        View activeLabel = item.findViewById(R.id.largeLabel);
        if (activeLabel instanceof TextView) {
            activeLabel.setPadding(0, 0, 0, 0);
        }
    }
}
karan
  • 8,637
  • 3
  • 41
  • 78
  • Hi bro i tried this one also but still have more padding see top i posted one answer working for thank you for your response – Uthaya Nov 29 '18 at 07:36