E
E
Eugene2018-07-24 11:55:18
Android
Eugene, 2018-07-24 11:55:18

How to make a main page menu from RecycleView?

Good afternoon. I'm starting to learn android programming and ran into a problem that I can't find the answer to. I want to make an application where on the main page, let's say, there will be a menu. I want to implement it through RecycleView, since there is the possibility of the OnClick method on any item, as well as apply various templates to it.
I began to study this RecycleView and realized that everywhere its filling goes through an array (string), but is it possible to specifically bind this picture and this text to this item, the second to the second, etc.
I do not really understand how to implement such a method, since I am a beginner, and plus this is not shown / told anywhere.
For you to understand, I will attach a similar picture, it is on ios, but the essence is the same.
5b56e8e050d25419354570.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Zagaevsky, 2018-07-24
@zagayevskiy

In order to populate a recycler, you need to implement an adapter . Inside the adapter, you can have a list of any data you want. When he asks you (onCreateViewHolder, onBindViewHolder) you must give your ViewHolder accordingly and fill it from your list.

S
Sergey, 2018-07-24
@red-barbarian

it's interesting and useful to
define a model that will return an image (resource) and text (resource)
example in the Defining a Model section. further on the pattern.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question