简体   繁体   English

更新实现'com.android.support:design:28.0.0'后,此item.setShiftingMode(false); 已被删除

[英]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 但是图标显示正确,但标签被截断,长文本仅显示一半

example 在此处输入图片说明

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"

That's all really its working 这就是它的全部工作 在此处输入图片说明

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.

相关问题 使用com.android.support:design:28.0.0的setOnTabSelectedListener崩溃 - Crash on setOnTabSelectedListener with com.android.support:design:28.0.0 无法解析com.android.support:design:28.0.0 - Could not resolve com.android.support:design:28.0.0 无法解析 com.android.support:design 28.0.0 - Could not resolve com.android.support:design 28.0.0 添加 com.android.support:design:28.0.0 依赖 - adding com.android.support:design:28.0.0 dependency 实现 &#39;com.android.support:appcompat-v7:28.0.0&#39; - implementation 'com.android.support:appcompat-v7:28.0.0' 实施 'com.android.support:appcompat-v7:28.0.0' - 错误 - implementation 'com.android.support:appcompat-v7:28.0.0' - Error 'com.android.support:design:28.0.0 的 Androidx 问题 - Androidx problem with 'com.android.support:design:28.0.0 实施实施&#39;com.google.firebase:firebase-database:18.0.0&#39;后,com.android.support:appcompat-v7:28.0.0错误 - com.android.support:appcompat-v7:28.0.0 error after implementing implementation 'com.google.firebase:firebase-database:18.0.0' com.android.support:design:28.0.0 - 版本 28 是旧版支持库的最后一个版本 - com.android.support:design:28.0.0 - Version 28 is the last version of the legacy support library 如何解决无法为参数[com.android.support:appcompat-v7:28.0.0]问题找到方法Implementation()? - How to solve Could not find method implementation() for arguments [com.android.support:appcompat-v7:28.0.0] problem?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM