私はビューにConstraintLayout
を使用しています。その中にはViewPager
があり、アダプタに含まれるビューの1つはRecyclerView
です。ContrastLayout内のViewPager内でRecyclerViewを使用する
私はちょうどイメージを置くことを試みるとき、私はもはやスクロールできない高さが欠けている。その高さは私が上に使っているスペース(Toolbar
+ TabLayout
)と同じに見えます。
代わりConstraintLayout
のRelativeLayout
を使用している場合、それはこれは私が見たものである
<?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>
動作します(最後のダースベイダーを参照)
app:layout_constraintBottom_toBottomOf="parent"
を追加することで解決
私は同様のケースがありました。実際にはツールバーのためでした。私はツールバーをスクロール可能にし、それはそのように修正されました。ツールバーをスクロール可能にするか、またはビューページでpaddingBottomを使用することができます – Lukingan
'paddingBottom'を使用することは解決策ではありません。ビューの欠落部分を計算したくないためです。それは迅速な回避策ですが、解決策ではありません。あなたは同意しませんか? –
ちょうど答えを得た@Lukingan。私はちょうど解決策を投稿しました –