Reputation: 5472
I'm using a ConstraintLayout
for my view. Inside it I placed a ViewPager
and one of the views that the adapter contains is a RecyclerView
.
When I try to put just images, there's a missing height where I can't scroll anymore. That height looks to be the same than the space I'm using on the top (Toolbar
+ TabLayout
).
When using RelativeLayout
instead of ConstraintLayout
it works
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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">
<RelativeLayout
android:id="@+id/homeToolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/toolbarColor">
<android.support.v7.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:padding="7dp"
android:src="@drawable/ic_menu"
tools:ignore="RtlHardcoded" />
<android.support.v7.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:gravity="center"
android:orientation="horizontal"
tools:ignore="RtlHardcoded">
<android.support.v7.widget.AppCompatImageView
style="@style/RippleEffect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:padding="7dp" />
<android.support.v7.widget.AppCompatImageView
style="@style/RippleEffect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:padding="7dp"
android:src="@drawable/ic_search" />
</LinearLayout>
</RelativeLayout>
<android.support.design.widget.TabLayout
android:id="@+id/homeTabLayout"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/toolbarColor"
app:layout_constraintTop_toBottomOf="@+id/homeToolbar"
app:tabMode="scrollable" />
<android.support.v4.view.ViewPager
android:id="@+id/homeViewPager"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@+id/homeTabLayout"
/>
</android.support.constraint.ConstraintLayout>
This is what I see (see the last Darth Vader)
Upvotes: 2
Views: 1198
Reputation: 5472
Solved by adding
app:layout_constraintBottom_toBottomOf="parent"
To the ViewPager
Upvotes: 4