I'm just wondering how to create a replica of this layout below

I tried
public class Utility {
public void setListViewHeightBasedOnChildren(ListView listView) {
ListAdapter listAdapter = listView.getAdapter();
if (listAdapter == null) {
return;
}
int totalHeight = 0;
for (int i = 0; i < listAdapter.getCount(); i++) {
View listItem = listAdapter.getView(i, null, listView);
listItem.measure(0, 0);
totalHeight += listItem.getMeasuredHeight();
}
ViewGroup.LayoutParams params = listView.getLayoutParams();
params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
listView.setLayoutParams(params);
}
but it sets the height of the ListView.
If you say that the HeaderView / FooterView will do the job, then also HOW ?.
If you say that the user layout (linear or relative), then I also can not use ScrollView in ScrollView.
Any other workaround?
Note . The data in the ListView will be dynamic (can be based on a query).
source
share