Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to scroll info windows in map v2?

i make a one app like a see data on a info windows my data is very long and i used scroll view for scroll info windows but not getting scroll event in map v2 so, tell me is it possible to scroll data on info windows in map.

i tried google but not getting any out put so i put my query here.

please see my below images. my data cut at bottom of the info windows but when i scroll info windows get map scroll event..

Error on this image

This is my layout file..

<?xml version="1.0" encoding="utf-8"?>

<ImageView
    android:id="@+id/badge"
    android:layout_width="130dp"
    android:layout_height="130dp"
    android:layout_gravity="center"
    android:layout_marginRight="5dp"
    android:adjustViewBounds="true"
    android:contentDescription="@string/image_not_available"
    android:src="@drawable/ic_zp" >
</ImageView>

 <ScrollView
    android:id="@+id/scroll"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" > 

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="left"
            android:ellipsize="end"
            android:singleLine="true"
            android:text="@string/title"
            android:textColor="@color/dark_blue"
            android:textSize="14sp"
            android:textStyle="bold" />

        <RelativeLayout
            android:id="@+id/Layout1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:visibility="visible" >

            <TextView
                android:id="@+id/lbl_company"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:paddingRight="3dp"
                android:singleLine="true"
                android:text="@string/lbl_company"
                android:textColor="@color/dark_gray"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/snippet"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@id/lbl_company"
                android:ellipsize="end"
                android:singleLine="false"
                android:text="@string/snippet"
                android:textColor="@color/dark_gray"
                android:textSize="14sp" />
        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/Layout2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:visibility="visible" >

            <TextView
                android:id="@+id/lbl_description"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:paddingRight="3dp"
                android:singleLine="true"
                android:text="@string/lbl_desc"
                android:textColor="@color/dark_gray"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/desc"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@id/lbl_description"
                android:ellipsize="end"
                android:singleLine="false"
                android:text="@string/snippet"
                android:textColor="@color/dark_gray"
                android:textSize="14sp" />
        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/Layout3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:visibility="visible" >

            <TextView
                android:id="@+id/lbl_salary"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:paddingRight="3dp"
                android:singleLine="true"
                android:text="@string/lbl_salary"
                android:textColor="@color/dark_gray"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/salary"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@id/lbl_salary"
                android:ellipsize="end"
                android:singleLine="false"
                android:text="@string/snippet"
                android:textColor="@color/dark_gray"
                android:textSize="14sp" />
        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/Layout4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:visibility="visible" >

            <TextView
                android:id="@+id/lbl_instructions"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:paddingRight="3dp"
                android:singleLine="true"
                android:text="@string/lbl_instructions"
                android:textColor="@color/dark_gray"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/instructions"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@id/lbl_instructions"
                android:ellipsize="end"
                android:singleLine="false"
                android:text="@string/snippet"
                android:textColor="@color/dark_gray"
                android:textSize="14sp" />
        </RelativeLayout>
    </LinearLayout>
 </ScrollView> 

like image 312
Roadies Avatar asked Oct 20 '22 15:10

Roadies


1 Answers

I dont think ScrollView is possible inside Custom InfoWindow. You can achieve your goal by following way.

Onclick of InfoWindow display dialog with entire description.

Like...

 map.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {

        @Override
        public void onInfoWindowClick(Marker arg0) {
            // TODO Auto-generated method stub
                    startActivity(new Intent(GoogleMAPV2Activity.this,
                    Customdialog.class));
            //here pass your data in intent

        }
    });

Customdialog contains TextView which displays your entire data.

Here are the screenshots :

enter image description here

enter image description here

This is alternative way of your requirement, but you can also use this. Hope it helps. Thanks, Happy Codding.

like image 144
Hardik Joshi Avatar answered Oct 23 '22 05:10

Hardik Joshi