I am facing problem to implement two listview in scrollview. I have activity in which I have scrollview. here is image what I want
layout design
actually design
I want to make invoice which contain two listviews one for items and one for tracking data. I am able to make listview height dynamically and also disable its click event. but now on listview I am not able to click or scroll screen. all components are in scrollview. but I am not able to scroll scrollview when I touch on listviews.
here is code where I'm managing height of listview
public static boolean setListViewHeightBasedOnItems(ListView listView) {
ListAdapter listAdapter = listView.getAdapter();
if (listAdapter != null) {
int numberOfItems = listAdapter.getCount();
// Get total height of all items.
int totalItemsHeight = 0;
for (int itemPos = 0; itemPos < numberOfItems; itemPos++) {
View item = listAdapter.getView(itemPos, null, listView);
float px = 500 * (listView.getResources().getDisplayMetrics().density);
item.measure(View.MeasureSpec.makeMeasureSpec((int)px, View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
totalItemsHeight += item.getMeasuredHeight();
}
// Get total height of all item dividers.
int totalDividersHeight = listView.getDividerHeight() *
(numberOfItems - 1);
// Get padding
int totalPadding = listView.getPaddingTop() + listView.getPaddingBottom();
// Set list height.
ViewGroup.LayoutParams params = listView.getLayoutParams();
params.height = totalItemsHeight + totalDividersHeight + totalPadding;
listView.setLayoutParams(params);
listView.requestLayout();
return true;
} else {
return false;
}
}`
I tried recyclerview and with this property
note_recyclerview.setNestedScrollingEnabled(false);
but I didn't get what I want.
how can I achieve this?