gpt4 book ai didi

android - 更改选项卡的图标大小

转载 作者:搜寻专家 更新时间:2023-11-01 08:33:42 25 4
gpt4 key购买 nike

我很难更改选项卡的图标大小。谁能帮我增加选项卡中显示的图标的大小?先感谢您。 Here is the project that I am doing

最佳答案

您可以在 for 循环中应用自定义布局:

mTabLayout.addTab(mTabLayout.newTab().setIcon(R.drawable.searchpin));
mTabLayout.addTab(mTabLayout.newTab().setIcon(R.drawable.discussionpin));
mTabLayout.addTab(mTabLayout.newTab().setIcon(R.drawable.userpin));

for (int i = 0; i < mTabLayout.getTabCount(); i++) {
TabLayout.Tab tab = mTabLayout.getTabAt(i);
if (tab != null) tab.setCustomView(R.layout.view_home_tab);
}

这是 xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:id="@android:id/icon"
android:layout_width="@dimen/tab_icon_size"
android:layout_height="@dimen/tab_icon_size"
android:layout_centerInParent="true"/>

</RelativeLayout>

关于android - 更改选项卡的图标大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38424126/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com