- I'm using retrofit for data fetching
- How do use different xml for both of sender and receiver.
Asked
Active
Viewed 94 times
-4
Saeef Minhaz
- 71
- 2
- 11
-
https://stackoverflow.com/q/26245139/115145 – CommonsWare Aug 16 '17 at 12:40
-
create two rows . eg . right.xml left.xml inflate them according to receiver or sender – akshay_shahane Aug 16 '17 at 12:40
-
https://stackoverflow.com/questions/26245139/how-to-create-recyclerview-with-multiple-view-type – XH6 user Aug 16 '17 at 12:40
2 Answers
0
You should use getItemViewType() of the RecyclerView.Adapter. Return different values for different views in that callback. You will receive that value in viewType of onCreateViewHolder callback. Inflate different layouts based on the viewType.
Bob
- 13,447
- 7
- 35
- 45
0
Create 2 views LEFT and RIGHT based on message type(Send or Received) Visible/Invisible LEFT/RIGHT view
Manoj Bhadane
- 607
- 5
- 11