S
S
Shohrukh Alimov2017-04-07 12:21:18
Android
Shohrukh Alimov, 2017-04-07 12:21:18

Is it possible to resize RecyclerView?

I want to resize the RecyclerView itself on click. For example, it has width & height parameters:

wrap_content
 match_parent
And on click I want to change to fixed parameters.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WelloGraphics, 2017-04-11
@AlimNinja

Wrap the RecyclerView in a RelativeLayout and apply LayoutParams to it.

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    >
    <android.support.v7.widget.RecyclerView
        android:id="@+id/images"
        android:layout_width="wrap_content"
        android:layout_height="360dp"
        >
    </android.support.v7.widget.RecyclerView>
 </Relativelayout>

RelativeLayout.LayoutParams lp =
            new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, 500);
 recyclerView.setLayoutParams(lp);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question