我使用的是安卓支持库BottomNavigationView,它在安卓的一些版本中看起来非常糟糕。
这是我的代码:
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#fff"
app:theme="@style/mydrawer"
app:itemIconTint="@drawable/selector"
app:itemTextColor="@drawable/selector"
app:menu="@menu/bottom_navigation_items" />
in styles :
<style name="mydrawer">
<item name="android:textSize">14sp</item>
</style>它在我的安卓6手机上看起来很好,但在大多数手机上看起来都很糟糕,比如:

如您所见,文本大小非常大
我该如何解决这个问题呢?
发布于 2018-01-01 22:03:18
您可以为所有设备指定一个文本大小值:
<style name="mydrawer">
<item name="android:textSize">14sp</item>
</style>而不是14sp,您应该从维度中指定值
<style name="mydrawer">
<item name="android:textSize">@dimen/bottom_bar_item_text_size</item>
</style>创建不同屏幕尺寸的dimens.xml文件。您应该为每个屏幕尺寸创建dimens.xml文件:
<dimen name="bottom_bar_item_text_size">14sp</dimen>
您的dimens.xml文件将如下所示:

希望这能有所帮助
发布于 2018-01-01 22:09:20
您可以使用底部导航ViewEx进行更多的自定义和更好的外观,使用方法与普通视图相似
https://stackoverflow.com/questions/48049957
复制相似问题