Issue
I am stuck in one situation...I have my parent layout as a scrollable layout. Inside this layout, I have a webview and a tablelayout. Some data are inflated in this scrollable layout.
My question is, my vertical scrollable functionality seems to be disabled since my scrollable layout already have the functionality. I hardly can scroll up and down inside the webview. And same situation for Mapview. I can only zoom in and zoom out using horizontal gesture. I wonder if there is any way to disable the scroll functionality only when I zoom in/out, scroll up/down in mapview/webview. Thank you so much.
Solution
WebView wv = (WebView)findViewById(R.id.myWebView); // your webView inside scrollview
wv.setOnTouchListener(new WebView.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;
}
});
And do same for MapView
it will work..
you can use mapview in fragment it also support map v2.
it is official, see this https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/MapView
Answered By - Hardik
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.