// <RelativeLayout
// android:id="@+id/map_layout"
// android:layout_width="match_parent"
// android:layout_height="300dp">
// <fragment
// android:id="@+id/mapview"
// android:layout_width="match_parent"
// android:layout_height="match_parent"
// android:layout_marginTop="-100dp"
// android:layout_marginBottom="-100dp"
// android:name="com.google.android.gms.maps.MapFragment"/>
// <ImageView
// android:id="@+id/transparent_image"
// android:layout_width="match_parent"
// android:layout_height="match_parent"
// android:src="@color/transparent" />
// </RelativeLayout>
ScrollView mainScrollView = (ScrollView) findViewById(R.id.main_scrollview);
ImageView transparentImageView = (ImageView) findViewById(R.id.transparent_image);
transparentImageView.setOnTouchListener(new View.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.
mainScrollView.requestDisallowInterceptTouchEvent(true);
// Disable touch on transparent view
return false;
case MotionEvent.ACTION_UP:
Allow ScrollView to intercept touch events.
mainScrollView.requestDisallowInterceptTouchEvent(false);
return true;
case MotionEvent.ACTION_MOVE:
mainScrollView.requestDisallowInterceptTouchEvent(true);
return false;
default:
return true;
}
}
});
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.