In my application, I display the data in a list. It looks like below.

Each line in a list is different (i.e. has a different presentation structure). But each line consists of 1 to many subheadings (all subordinates are the same).
Problem: if you are trying to inflate lines from xml, then I need to have xml with 1. 2 sub-views 2. 3 sub-views 3. 5 approaches, etc.
If I try to build the rows dynamically, then I will not be able to use the holder template or the reusability of Listview. And I end up creating subviews if the number of subviews in the returned view is less than required or deleted in case the subviews are more than required.
, listview, ?
Edit:
ArrayAdapter getView, getViewTypeCount, getItemViewType
@Override
public int getItemViewType(int position) {
return mListItems.get(position).getViewToBeRenderened().getViewId();
}
@Override
public int getViewTypeCount() {
return AppConstants.VwViewTypes.values().length;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final VWListItem listItem = mListItems.get(position);
if(listItem == null || listItem.getViewToBeRenderened() == null){
return convertView;
}
VWView renderingView = listItem.getViewToBeRenderened();
if(convertView == null ){
convertView = renderingView.buildView(mContext.appContext);
}
...
}
, 2-3 . xml , .
, . . , .