Reputation: 1491
I cant use a listview because I require a scrollview on the screen. What is the best alternative in which I can pass it the .xml file I created that contains all the views that I want to be considered as a single list item.
EDIT
I cant use a listview because Listviews should never be children of ScrollViews
Upvotes: 0
Views: 6094
Reputation: 1267
Have a LinearLayout
with the orientation that you need
In your Activity
/Fragment
, loop for all the items you want to add to the view (similar to getView() of the Adapter
of a ListView
.
In each iteration of the loop, inflate the common view layout xml file. Do what you have to do to the views inside the layout.
At the end of each iteration of the loop, add the newly inflated view to the linear layout.
In essence, you are just emulating what the ListView
should be doing anyways.
Upvotes: 2