TaLha Khan
TaLha Khan

Reputation: 2433

2 elements layout and listview inside scroll view

I want to scroll a parent container having linear layout and listview as its child layouts. The problem is that ListView scroll doesnt work inside ScrollView, i have tried this but didnt work.

Android list view inside a scroll view


I want to make it look like as if the "simple layout" is ListView's 0th item. So simple layout scroll with the listview rows. I think its doable by using different layouts inside getView in List Adapter but simple layout will going to have 2 dropdowns and button which will be used to control the below list just like a filter. So i think its not a good idea to do this as all the click handlers for dropdown and button will be inside getView.

two layouts inside once scrollable container

Upvotes: 1

Views: 249

Answers (2)

Kazaky
Kazaky

Reputation: 41

  • You Can use ListView HeaderView As mentioned above,

  • Also You can put them both ( ListView & Simple Layout ) inside a parent LinearLayout Then include the parent LinearLayout inside a parent ScrollView

Upvotes: 3

A-S
A-S

Reputation: 3125

In my opinion, you are not approaching it right. All you want to do is to add a header to the list.

This can be done easily by the ListView object itself. Try this: How to use addHeaderView to add a simple ImageView to a ListView

Upvotes: 1

Related Questions