开发者

Android using Scrollview in a scrollview

when i tried to use scrollview or webview i开发者_开发问答n a scrollview, the inside scrollview or webview can not scroll. I can scroll with trackball but I can't scroll with touch. Do you have any idea about this issue?


I found something and it works for me. I wanted to share. Here it is, I have one scrollview and listview. listview inside scrollview. Scrollview-> RelativeLayout-> Listview. That listener belongs to Listview;

@Override
public boolean onTouch(View v, MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_MOVE) {
        ScrollView().requestDisallowInterceptTouchEvent(true);
    }
    return false;
}


Android does not support using ScrollViews or ListViews inside each other. It's possible to do, but it's A Bad Thing (TM), according to Google developers.

Search SO for similar problems with ListViews, and you'll find several discussions + suggestions on how to hack around the limitations of the OS. However, I would strongly suggest you reconsider your layout to try and find some other way to handle your layout.


ScrollView supports only one direct child; it can be either a LinearLayout or a RelativeLayout. If you have more than one children the scroll wouldn't work properly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜