Java – How to create a ListView with multiple views

How to create a ListView with multiple views… here is a solution to the problem.

How to create a ListView with multiple views

My question is – how to create a custom ListView that doesn’t just repeat a custom View, but like an app that includes other Views in Instagram or other lists, it looks like ScrollView with ListView Other Views in Android, but Roman Guy says “ListView in ScrollView.” is a very bad way”, I agree with it, don’t trust which Google uses this way….

What is the best way to use a ListView or Recycler View for this

enter image description here

enter image description here

Solution

To implement the UI, you must define multiple View types for a Listview or Recyclerview; here answers a very similar question.

In your example, you will have two View types:

  • <Horizontal Scroll> is a <a href=” https://stackoverflow.com/questions/33456216/android-layout-horizontal-recyclerview-inside-a-vertical-recyclerview-inside-a” rel=”noreferrer noopener nofollow”>embedded horizontal Recyclerview/Listview 。
  • <View >, which is the View type that you defined.

There are many tutorials. Since its advantages over Listview, I recommend that you use it in your implementation Recyclerview。

Related Problems and Solutions