首页 > 解决方案 > 增加 Tab 和 TabLayout 之间的间隙

问题描述

我想增加选项卡和选项卡布局之间的差距。
现在我有了这个。检查图像。我尝试方法边距和填充,但我无法解决它..我想要填充底部在此处输入图像描述

我的代码是:

<?xml version="1.0" encoding="utf-8"?>
<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"
    android:orientation="vertical"
    android:fitsSystemWindows="true"
    tools:context=".Fragments.MainFragment">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/black"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />

        <com.google.android.material.tabs.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:tabSelectedTextColor="@color/white"
            app:tabBackground="@drawable/tab_color_selector"
            style="@style/MyTabLayout"
            app:tabMode="scrollable"
            app:tabGravity="center"
            app:tabPaddingStart="30dp"
            app:tabPaddingEnd="30dp"
            app:tabIndicatorHeight="0dp"
            />

    </com.google.android.material.appbar.AppBarLayout>
   
</RelativeLayout>

标签: xmlandroid-studioandroid-layout

解决方案


推荐阅读