i’m trying to place a listview inside a listviewitem. the inner listview should not be scrollable but take all size it needs to display all it’s rows. is there a better way to to this? table, grid, …? the problem i’m facing right now is that the inner listview doesn’t take the space it needs, so it’s cut at about the end of the first listitem. if i try to scroll, just the outer listview is scrolling which is exactly what i want.

thanks, my final solution is
LinearLayout layout = (LinearLayout) row.findViewById(R.id.LLBroadcasts);
layout.removeAllViews();
for (Item b : bs.getItems()) {
View child = _inflater.inflate(R.layout.item_row, null);
TextView tvTitle = (TextView) child.findViewById(R.id.TVItemTitle);
tvTitle.setText(b.getTitle());
TextView tvDesc = (TextView) child.findViewById(R.id.TVItemDescription);
tvDesc.setText(b.getDescription());
layout.addView(child);
}
From the Android documentation – Listview: ListView is a view group that displays a list of scrollable items
You do not really want to scroll that inner list view, you want to scroll the outer listview. However I asume that the inner listview may vary on the amount of elements it contains.
Instead of the inner list view you could use a
For the linear layout (some sample code):
You should save the linear layout in a view holder (see View Holder pattern). I think the
removeAllViews()is only necessary when the current row has lesser inner rows than the reused one, so I would also save the number of rows in the view holder.If the maximum number of inner rows is not to high you could also think about caching them in the view holder to avoid the inflate and findByViewId (lets say in an ArrayList).