Rick Joe Rick Joe -4 years ago 170
Android Question

Recyclerview scrolling up usually jumps up to previous item using match_parent in the imageview

When I scroll up my recyclerview using

match_parent
in the imageview everytime it has an image the scroll bar will automatically jump upper to the previous item.

The same happens when I define a width to the image (400dp) - smaller than it, no problem happens.

any ideas why my recyclerview jump up when it has and image with
match_parent
?

carview

<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<LinearLayout
android:padding="@dimen/activity_horizontal_margin"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<com.android.volley.toolbox.NetworkImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="0dp"
android:id="@+id/imageViewHero"
android:adjustViewBounds="true" />...


recyclerview

<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true" />


oncreateviewholder

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.posts_list, parent, false);
ViewHolder viewHolder = new ViewHolder(v);
return viewHolder;
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {

Posts post = Posts.get(position);
holder.post = post;

//Loading image from url
imageLoader = CustomVolleyRequest.getInstance(context).getImageLoader();

//Showing data on the views
holder.imageView.setImageUrl(post.getImageUrl(), imageLoader);
holder.textViewName.setText(post.getName());
holder.textViewPublisher.setText(post.getPublisher());

holder.setIsRecyclable(false);

}

Answer Source

I believe that you are having an issue with changes to how RecyclerView layouts are handled starting with revision 23.2.0.

See the answer from Sevle here that references revision 23.2.0 changes to RecyclerView here.

For a fuller explanation, see this posting.

It all very confusing, but I hope this helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download