Monday, February 17, 2014

Anxious vomiting, seek online help heroes! ! ! scrollview added mapview focus to get the problem


posts by congjianfei edited 2013-04-15 11:09:38
Now I have to do an application, the overall use of scrollview, because a lot of things display, which has a control is Mapview, requires mapview, which is able to slide the map, but the emergence of a serious problem now, mapview not get the focus, so he All events can trigger? ? ? Kneeling, etc., vomiting seek expert advice online, very anxious very anxious very anxious very anxious very anxious! ! !<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Need intercepted scrollview of ontouch event

This requires you to define a srocllview inherited srocllview.
public class MyScrollView extends ScrollView {

private boolean isIntercept = false;

public MyScrollView (Context context) {
super (context);
}

public MyScrollView (Context context, AttributeSet attrs, int defStyle) {
super (context, attrs, defStyle);
}

public MyScrollView (Context context, AttributeSet attrs) {
super (context, attrs);
}

@ Override
public boolean onInterceptTouchEvent (MotionEvent ev) {
if (isIntercept) {
return false;
}
return super.onInterceptTouchEvent (ev);
}

public boolean isIntercept () {
return isIntercept;
}

public void setIntercept (boolean isIntercept) {
this.isIntercept = isIntercept;
}
}

By a boolean to control ontouch events.
Only modify the boolean value, can get hold of what buttons to modify.
Reply:
Dude, thanks! Get, you said to me very enlightening, vomiting stopped, the problem is solved!
Reply:
To contribute about how to solve it?

No comments:

Post a Comment