我正试图增加我的应用程序中选项卡的图标大小。图标大小是固定的尝试了很多方式,但没有任何工作,最后尝试了以下,但没有改变的大小。请如果任何人可以告诉我正确的方式,我会很高兴。提前感谢。如何增加TabLayout中选项卡的图标大小
这里是我的代码,
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
tabLayout.addTab(tabLayout.newTab().setIcon(R.drawable.my1));
tabLayout.addTab(tabLayout.newTab().setIcon(R.drawable.feed_s));
tabLayout.addTab(tabLayout.newTab().setIcon(R.drawable.add_ds1));
tabLayout.addTab(tabLayout.newTab().setIcon(R.drawable.history_ds));
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
style.xml
<style name="AppTheme.ActionBar" parent="Widget.AppCompat.Light.ActionBar">
<item name="android:layout_width">50dp</item>
<item name="android:layout_height">50dp</item>
</style>
tablayout.xml
非常感谢。这是最好的解决方案:) – veena
但我需要为每个选项卡图标创建不同的视图 – veena
欢迎您,我会为您更新答案 –