adamacdo
adamacdo

Reputation: 426

Creating a large ListView with custom complex child Views

I have an unusual project that I need to display large sets of questions to the user. Given the amount of questions that will be shown on the screen and accessible by the user I have opted to using a ListView. I tried a ScrollView, but it wasn't as efficient as I wanted, and lagged when dynamically adding new sets of questions.

The basic structure will be a ListView whose children are custom Views that I have created that have LinearLayouts inside that expand and collapse based on a button in each custom view. The LinearLayouts will hold the question's widgets, TextViews, Buttons, EditTexts, etc. In each collapsible view there will be at least 20 widgets. There will be many custom views in the ListView. One problem I had was scrolling of the ListView when showing that many widgets. It worked OK when the custom views were collapsed, but when a bunch were expanded it lagged the scroll.

Is there a more efficient way of displaying huge amounts of widgets than enclosing them in a ListView? I thought ListView might be my best bet because it recycles the Views.

This is a very unusual project, as the questions inside the ListView will change dramatically based on certain information entered by the user.

Upvotes: 2

Views: 302

Answers (1)

Jordi Coscolla
Jordi Coscolla

Reputation: 1066

For having this kind of list is better to use the ExpandableListView

It have a better performance but you only draw one item expaned.

Upvotes: 1

Related Questions