Question

Am using Map inside horizontal scrolling. My problem is when i try to scroll horizontally this work fine but when i try to move or zoom mapview this is not working. Why?

I guess this may be because of scrollview scrolling functionality.

 <?xml version="1.0" encoding="utf-8"?>
 <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/horizontal_scroll"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:background="#ffffff"
    android:fadingEdge="none" >

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

    <!-- Map Panel -->

    <RelativeLayout
        android:id="@+id/map_panel"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <RelativeLayout
            android:id="@+id/headerLayout"
            android:layout_width="fill_parent"
            android:layout_height="55dp"
            android:background="@drawable/greybar_head"
            android:gravity="center_vertical" >

            <ImageView
                android:id="@+id/stpLogo"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:src="@drawable/st_icon_new" />

            <TextView
                android:id="@+id/PropertyTypeText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true"
                android:background="@drawable/img_prop_for"
                android:gravity="center_vertical|center_horizontal"
                android:paddingLeft="15dp"
                android:paddingRight="30dp"
                android:text="For Sale"
                android:textStyle="bold"
                android:visibility="gone" />
                </LinearLayout>

                <ListView
                    android:id="@+id/ListItemView"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/LeftHeaderLayout"
                    android:cacheColorHint="@color/transparent"
                    android:choiceMode="singleChoice"
                    android:listSelector="@drawable/list_selector" >
                </ListView>
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/mapInnerLayout"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@+id/leftListView"
                android:gravity="center_vertical" >

                <fragment
                    android:id="@+id/map"
                    android:layout_width="fill_parent"
                    android:layout_height="match_parent"
                    android:layout_centerInParent="true"
                    class="com.stp.stproperty.shared.MySupportMapFragment" />
            </RelativeLayout>

Was it helpful?

Solution

After all i found solution to my problem is to override the ontouch event of horizontal scrollview as like ...

public class CustomScrollView extends HorizontalScrollView {

public CustomScrollView(Context context, AttributeSet attrs) {
    super(context, attrs);
}
public boolean onTouchEvent(MotionEvent ev) {
    return true;
}
public boolean onInterceptTouchEvent(MotionEvent ev) {
    return false;
}

}

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top