0
Вот мой макет:Tablayout покрывает ViewPager внутри CoordinatorLayout
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
app:elevation="2dp"
android:layout_height="wrap_content">
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/tab_layout_bg"
app:tabIndicatorColor="@color/tab_indicator_color"
app:tabGravity="fill"/>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
Это единственное решение, чтобы добавить отступы к ViewPager?
Является ли ваш tablayout в верхней или нижней части экрана? Возможно, попробуйте добавить его поверх viewpager в xml. Это единственное различие, которое я могу заметить из своего проекта, и мои работы :) – Vucko