更改BottomNavigationView的图标大小 [英] Changing BottomNavigationView's Icon Size
本文介绍了更改BottomNavigationView的图标大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在尝试使用新的BottomNavigationView并尝试对其进行自定义.
I have been experimenting with the new BottomNavigationView and trying to customise it.
到目前为止,我已经成功使用以下方法更改了高度和边距:
So far I have managed to change the height and margins by using the below:
<dimen name="design_bottom_navigation_height" tools:override="true">75dp</dimen>
<dimen name="design_bottom_navigation_margin" tools:override="true">5dp</dimen>
我想增加图标的大小.
这怎么办?
编译版本:com.android.support:design:25.0.1
Compile Version: com.android.support:design:25.0.1
推荐答案
最新但最新
使用implementation 'com.android.support:design:28.0.0'
设计支持库.
有一个属性可以更改图标大小:
There is an property to change Icon Size:
<android.support.design.widget.BottomNavigationView
app:itemIconSize="@dimen/_26sdp">
....
....
</android.support.design.widget.BottomNavigationView>
以编程方式:
dashboardNavigation.setItemIconSize(24);
更新:
如果您使用的是材质库,则将是相同的.只需按如下所示更改程序包名称即可.
UPDATE:
If you are using a material library then it will be the same. Just change the package name as below.
implementation 'com.google.android.material:material:1.1.0'
XML:
<com.google.android.material.bottomnavigation.BottomNavigationView
app:itemIconSize="@dimen/_26sdp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
以编程方式-与上面相同.
谢谢.
这篇关于更改BottomNavigationView的图标大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文