I have one activity that includes some textviews and one recyclerView that has images displayed with Glide. I had a problem that recyclerview has its own scroller that I don't need.
Then I added this: android:nestedScrollingEnabled="false" to RecyclerView xml
according to RecyclerView need to scroll along the activity
and now recyclerview is scrolling along with activity, but now there is another problem. Not all images are visible. It looks like that RecyclerView does not know what is the size of all images inside it while it is inflating. I am using Glide for displaying images, and image item has fixed size 250dp.
If I remove nestedScrollingEnabled attribute, then all images are visible but I need to scroll inside that recyclerView.
this is my recyclerview
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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="fill_parent"
android:layout_height="fill_parent">
<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:id="@+id/activity_prikazi_vest"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin1"
android:paddingRight="@dimen/activity_horizontal_margin1"
android:paddingTop="@dimen/activity_horizontal_margin1"
android:scrollbars="vertical"
tools:context="myapp.app.news">
----------------here are some textviews----------------------
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view_images"
android:nestedScrollingEnabled="false"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:scrollbars="none"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintVertical_bias="0.0" />
</android.support.constraint.ConstraintLayout>
</ScrollView>
this is setting I use for Glide
RequestOptions options = new RequestOptions()
.centerCrop()
.placeholder(R.drawable.image1)
.error(R.drawable.image2)
.priority(Priority.HIGH);
Update:
to have smooth scroll please use this inside recyclerview
android:nestedScrollingEnabled="false"
android:isScrollContainer="false"