I am trying to add list view under scroll view so that i can scroll whole page as well as my list view but my list view is not scrolling while my whole page is scrolling.
This is my XML :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar"
android:background="@color/white">
<LinearLayout
android:id="@+id/layout_form"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginBottom="5dp"
android:background="@color/trans_white"/>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/list_prdt_detail"
android:divider="@color/white"
android:layout_marginBottom="50dp"
android:scrollbars="vertical"/>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2"
android:layout_gravity="center"
android:gravity="center"
android:layout_alignParentBottom="true">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ADD TO CART"
android:background="@color/orange"
android:layout_weight="1"
android:layout_gravity="center"
android:gravity="center"
android:padding="20dp"
android:textColor="@color/white"
android:fontFamily="sans-serif"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="BUY NOW"
android:background="@color/red"
android:layout_weight="1"
android:layout_gravity="center"
android:gravity="center"
android:padding="20dp"
android:textColor="@color/white"
android:fontFamily="sans-serif"/>
</LinearLayout>
</RelativeLayout>
This is my java :
listAdapter = new
AdapterProddetail(Productdetail.this,al_prod_id,
al_prod_image,al_prod_name,al_prod_price,
al_prod_disc,al_prod_discount,al_prod_stock,al_prod_cc);
list_prdt_detail.setAdapter(listAdapter);
list_prdt_detail.setOnItemClickListener(this);
list_prdt_detail.setOnTouchListener(new
ListView.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
// Disallow ScrollView to intercept touch
events.
v.getParent().requestDisallowInterceptTouchEvent(true);
break;
case MotionEvent.ACTION_UP:
// Allow ScrollView to intercept touch events.
v.getParent().requestDisallowInterceptTouchEvent(false);
break;
} // Handle ListView touch events.
v.onTouchEvent(event);
return true;
}
});
I have add java code that will disallow scroll intercept but still list view not scrolling.Please help me to overcome this situation.