I have seen this post before with the same question, but recently Google introduced another TabLayout
QUESTION: Is there a way of reducing the space between text and icon using an attribute for instance, or another google-maintainable method in order to avoid having to go through creating a separate layout with text and an icon?
My current layout looks like this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.viewpager.widget.ViewPager
android:id="@+id/mViewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/homeTabs">
<com.google.android.material.tabs.TabLayout
style="@style/Widget.MaterialComponents.TabLayout"
android:id="@+id/homeTabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:tabIndicatorColor="@color/clear_blue">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/one_svg"
android:text="@string/one"/>
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/two_svg"
android:text="@string/two"/>
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/three_svg"
android:text="@string/three"/>
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/four_svg"
android:text="@string/four"/>
</com.google.android.material.tabs.TabLayout>
</RelativeLayout>