Replace ScrollView by android.support.v4.widget.NestedScrollView inside xml. it runs
1) Use in XML:::: android.support.v4.widget.NestedScrollView
instead of:::: ScrollView
2) And use for list view in this way using NonScrollListView in cs file:
public class NonScrollListView extends ListView {
public NonScrollListView(Context context) {
super(context);
}
public NonScrollListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public NonScrollListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec(
Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom);
ViewGroup.LayoutParams params = getLayoutParams();
params.height = getMeasuredHeight();
}
}
3) Finally use this code to identify scrollview in cs file:
NonScrollListView listView = (NonScrollListView) view.findViewById(R.id.listview);