Deal All,
I have a problem;
I have a layout with scroll view over three list view A,B,C.
I want scroll hole layout as well as scroll each list view.
problem:
List view are not scroll when layout is scroll if I remove scroll layout then list is scroll but layout is not scroll.
Please give me a any possible solution Thanks in advance.
we cant scroll listview within scrollview,
because listview itself contains scroll option.
check this link
http://code.google.com/p/android/issues/detail?id=6552
this will help.
by that listview bug can do that list in scroll.
Thanks.
Use the following method and enjoy!
private void setListViewScrollable(final ListView list) {
list.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
listViewTouchAction = event.getAction();
if (listViewTouchAction == MotionEvent.ACTION_MOVE)
{
list.scrollBy(0, 1);
}
return false;
}
});
list.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view,
int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
if (listViewTouchAction == MotionEvent.ACTION_MOVE)
{
list.scrollBy(0, -1);
}
}
});
}
listViewTouchAction is a global integer value.
If you can replace the line
list.scrollBy(0, 1);
with something else please share it with us.