在 Kotlin 的 Android TabLayout 中更改选项卡的大小

Change size of Tabs in Android TabLayout In Kotlin

我是 Android 和 Kotlin 的新手。我正在尝试开发一个包含带有 2 个选项卡的 TabLayout 的应用程序。标题相当大,无论我做什么,我都无法让事情看起来正确。该应用程序仅以水平模式显示,因此顶部栏中的标题有很多 space,但选项卡标题似乎是固定的。因此,文本大小太小。我尝试过更改文本大小、更改样式,甚至尝试增加选项卡布局的大小,但都无济于事。似乎没有什么可以改变选项卡本身的文本大小。有人可以帮我提供一些代码来进行此更改吗?
预先感谢您的帮助! 样式:

<style name="MyTabLayout" parent="Base.Widget.Design.TabLayout">
    <item name="tabTextAppearance">@style/MyTabTextAppearance</item>
    <item name="android:textSize">36sp</item>
</style>
<style name="MyTabTextAppearance">
    <item name="android:textSize">36sp</item>
    <item name="android:textColor">@android:color/white</item>
    <item name="textAllCaps">true</item>
</style>

选项卡布局:

<com.google.android.material.tabs.TabLayout
                app:tabTextAppearance="@style/MyTabTextAppearance"
                android:id="@+id/tabs"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="fill_horizontal"
                android:background="?attr/colorPrimary"
                android:textAlignment="center"
                android:textSize="36sp"
                app:tabGravity="fill" />

尝试这种风格:

 <style name="MyTabStyle" parent="Base.Widget.Design.TabLayout">
 <item name="android:textSize">36sp</item>
 <item name="android:textAllCaps">true</item>
 </style>

并在 Tablayout 中应用:

 <com.google.android.material.tabs.TabLayout
            app:tabTextAppearance="@style/MyTabTextAppearance"
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="fill_horizontal"                             
            app:tabTextAppearance="@style/TabLayoutStyle"
            android:background="?attr/colorPrimary"
            app:tabGravity="fill" />