My List View Does Not Get Scrolled
PFB my layout My listView does not get scrolled I have 3 list below one relative layout Its the structure that like when I click on Relative Layout The list gets visible . Its w
Solution 1:
The reason behind that it - Your listview is inside ScrollView
Do as following to fix your trouble -
ListView lv = (ListView)findViewById(R.id.landHoldingList); // your listview inside scrollview
lv.setOnTouchListener(new ListView.OnTouchListener() {
@Override
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;
}
});
What this does is disable the TouchEvents on the ScrollView and make the ListView intercept them. It is simple and works all the time.
Post a Comment for "My List View Does Not Get Scrolled"