Google Maps V2 for Android中的自定义信息窗问题

时间:2013-11-29 22:59:45

标签: android google-maps

任何人都知道如何删除自定义信息窗口的边缘

enter image description here

这是我的infowindow的XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@color/negro"
    android:orientation="horizontal" >

    <ImageView
         android:id="@+id/image_mapa"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_marginRight="10dp"
        android:adjustViewBounds="true"
        android:src="@drawable/ic_launcher" />

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

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Las Flores"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@color/blanco"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/snippet"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Resto bar"
            android:textColor="@color/blanco" />

        <TextView
            android:id="@+id/descuento"
            android:layout_width="100dp"
            android:layout_height="wrap_content"
            android:text="20% OFF"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@color/verde_habitues"
            android:textStyle="bold" />

    </LinearLayout>

</LinearLayout>

我正在使用一个实现InfoWindowAdapter的adaptar

谢谢!

1 个答案:

答案 0 :(得分:7)

解决方案在适配器上而不是覆盖 getInfoContents 覆盖设置InfoWindow

public class MyInfoWindowAdapter implements InfoWindowAdapter
{
    private final View myContentsView;
    private Context ctx;

    public MyInfoWindowAdapter(View myContentsView, Context ctx)
    {
        this.myContentsView = myContentsView;
        this.ctx = ctx;
    }

    @Override
    public View getInfoContents(Marker marker)
    {
        return null;
    }

    @Override
    public View getInfoWindow(Marker marker)
    {


    TextView tvTitle = ((TextView)myContentsView.findViewById(R.id.title));
        tvTitle.setText(marker.getTitle());        


        return myContentsView;

    }

}

enter image description here