Recylerview Horizontal as Whatsapp

Asked

Viewed 185 times

1

I would like the help of you how to make this layout of the "Media" part in a particular Whatsapp Contact. Would this be CardView whole called "Media".

CardView Midia do WhatsApp

It would be almost exactly the same way, I have no doubt about the Adapters, just doubt about the layout xml. The images would also be all the same size in this square.

1 answer

2


When you create a Recyclerview you have to assign a Layoutmanager. In this case (horizontal list) assign a Linearlayoutmanager specifying LinearLayoutManager.HORIZONTAL in the builder:

LinearLayoutManager manager = new LinearLayoutManager(this, 
                                                      LinearLayoutManager.HORIZONTAL, false);

RecyclerView midiaList = (RecyclerView) findViewById(R.id.a_sua_recycler_view);
midiaList.setLayoutManager(manager);
  • And how will Recyclerview items look in that specific size? All squares exactly like the image?

  • Squares can be obtained using a Cardview as the parent of your Rows

  • I refer to the squares within the media and not the external ones that are Cardviews. Squares are the listed images within a horizontal view.

  • I think it depends on the layout that defines each row (column in this case) of Recyclerview.

  • Of the two one. Either are simple imageviews with rounded corners, or else is another recyclerview but with vertical orientation

  • @Pedrooliveira do not look at the cardviews, just look at what is under the text Media.

  • exactly what @ramaral said I also want to know.

  • How can it be vertical if images are displayed horizontally?

  • @ramaral tested what you put in the answer worked. I also managed to define the images that even in Whatsapp, I chose a little bigger for each item in the list that was 96dp. The problem now was that recyclerview does not get "wrap_content" even setting its height like this. It takes all the remaining space as if it were "match_parent". You know what it can be?

  • Lucas, best is you create a new question where you should post the xml of that part and if possible an image.

Show 5 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.