底部导航栏:按下时文本大小是否增加?
2022-09-02 14:26:12
尝试在文件中添加此代码dimens.xml
<dimen name="design_bottom_navigation_text_size" tools:override="true">10sp</dimen>
<dimen name="design_bottom_navigation_active_text_size" tools:override="true">10sp</dimen>
您可以通过样式设置底部导航视图的活动和非活动文本外观:
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/BottomNavigationView"/>
将以下样式放入文件中styles.xml
<style name="BottomNavigationView">
<item name="itemTextAppearanceActive">@style/TextAppearance.BottomNavigationView.Active</item>
<item name="itemTextAppearanceInactive">@style/TextAppearance.BottomNavigationView.Inactive</item>
</style>
<!-- blank styles for better code readability-->
<style name="TextAppearance"/>
<style name="TextAppearance.BottomNavigationView"/>
<!-- inactive tab icon style -->
<style name="TextAppearance.BottomNavigationView.Inactive">
<item name="android:textSize">12sp</item>
</style>
<!-- active tab icon style -->
<style name="TextAppearance.BottomNavigationView.Active">
<item name="android:textSize">12sp</item>
</style>
使用 TextAppearance,您不仅可以控制 ,还可以控制 诸如 等属性。textSize
fontFamily