[英]After updating implementation 'com.android.support:design:28.0.0' this item.setShiftingMode(false); has been removed
after updating 28.0.0 i removed item.setShiftingMode(false);
更新28.0.0后,我删除了
item.setShiftingMode(false);
then i added this app:labelVisibilityMode="labeled"
to xml. 然后我将这个
app:labelVisibilityMode="labeled"
到xml。
But icon showing correct but label is cut off long text showing only half 但是图标显示正确,但标签被截断,长文本仅显示一半
performance cut off please give me suggestion thank you for your advance. 性能下降请给我建议,谢谢您的进步。
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.xml文件:
<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"
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);
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.