I'm trying to find out how to delete this white padding line:
my activity
:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".activity.ShowUI">
<androidx.appcompat.widget.Toolbar
android:id="@+id/show_ui_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/AppTheme"
app:layout_constraintTop_toTopOf="parent"
app:titleTextColor="@android:color/white" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/show_ui_tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?actionBarSize"
app:tabGravity="fill"
app:tabIndicatorColor="@android:color/black"
app:tabIndicatorHeight="2dp"
app:tabBackground="@color/colorPrimary"
app:tabMode="fixed">
</com.google.android.material.tabs.TabLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/show_ui_viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.viewpager.widget.ViewPager>
</LinearLayout>
I can't find where the problem is. Thank you!
Just Remove The android:minHeight="?actionBarSize"
from the TabLayout
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".activity.ShowUI">
<androidx.appcompat.widget.Toolbar
android:id="@+id/show_ui_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/AppTheme"
app:layout_constraintTop_toTopOf="parent"
app:titleTextColor="@android:color/white" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/show_ui_tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabGravity="fill"
app:tabIndicatorColor="@android:color/black"
app:tabIndicatorHeight="2dp"
app:tabBackground="@color/colorPrimary"
app:tabMode="fixed">
</com.google.android.material.tabs.TabLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/show_ui_viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.viewpager.widget.ViewPager>
</LinearLayout>
Or alternatively, you can set the height of TabLayout to ?actionBarSize instead of specifying it as minHeight like this
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".activity.ShowUI">
<androidx.appcompat.widget.Toolbar
android:id="@+id/show_ui_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/AppTheme"
app:layout_constraintTop_toTopOf="parent"
app:titleTextColor="@android:color/white" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/show_ui_tabLayout"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:tabGravity="fill"
app:tabIndicatorColor="@android:color/black"
app:tabIndicatorHeight="2dp"
app:tabBackground="@color/colorPrimary"
app:tabMode="fixed">
</com.google.android.material.tabs.TabLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/show_ui_viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.viewpager.widget.ViewPager>
</LinearLayout>