android – 如何在TabLayout中设置图标大小?

android – 如何在TabLayout中设置图标大小?,第1张

概述这是我的代码: private TabLayout tabLayout;private int[] tabIcons = { R.mipmap.ic_compass, R.mipmap.ic_place, R.mipmap.ic_passport, R.mipmap.ic_setting};...tabLayout.get 这是我的代码:
private TabLayout tabLayout;private int[] tabIcons = {        R.mipmap.ic_compass,R.mipmap.ic_place,R.mipmap.ic_passport,R.mipmap.ic_setting};...tabLayout.getTabAt(0).setIcon(tabIcons[0]);tabLayout.getTabAt(1).setIcon(tabIcons[1]);tabLayout.getTabAt(2).setIcon(tabIcons[2]);tabLayout.getTabAt(3).setIcon(tabIcons[3]);

图标大小取决于图像大小.我怎么能调整它?

解决方法 设置图标填充
for (int i = 0; i < tablayout.getTabWidget().getChildCount(); i++)    {        tablayout.getTabWidget().getChildAt(i).setpadding(10,10,10);    }
总结

以上是内存溢出为你收集整理的android – 如何在TabLayout中设置图标大小?全部内容,希望文章能够帮你解决android – 如何在TabLayout中设置图标大小?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1130544.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存