InfoWindowAdapter布局的问题

时间:2014-05-28 15:42:57

标签: android android-layout google-maps-markers

我实现了一个布局用于弹出地图标记(Maps V2),但我无法根据需要配置我的布局。

在下面的图像中,您可以看到有关标记的信息的弹出窗口有白色边框,我需要删除它。我用黄色填充弹出背景(作为中间框)。

我的布局xml有什么问题?

enter image description here

我的XML(info_window_map)          

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:background="@color/pastel" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:background="@color/blue_nightsky"
            android:orientation="horizontal"
             >

            <TextView
                android:id="@+id/linha_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Linha "
                android:textColor="@color/white"
                android:textSize="13sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/cod_linha"
                android:layout_width="match_parent"
                android:layout_height="fill_parent"
                android:textColor="@color/white"
                android:textSize="13sp"
                android:layout_gravity="left"
                android:layout_marginLeft="5dp"
                android:textStyle="bold" />            
        </LinearLayout>

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

            <TextView
                android:id="@+id/onibus_label"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Ônibus....: "
                android:textColor="@color/black"
                android:textSize="12sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/cod_onibus"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="@color/black"
                android:textSize="12sp" />
        </LinearLayout>

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

            <TextView
                android:id="@+id/previsao_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Previsão..: "
                android:textColor="@color/black"
                android:textSize="12sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/previsao"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="@color/black"
                android:textSize="12sp" />
        </LinearLayout>
    </LinearLayout>


</LinearLayout>

我的适配器(使用xml)

class MyInfoWindowAdapter implements InfoWindowAdapter{

        private final View myContentsView;

        MyInfoWindowAdapter(){
            myContentsView =  getLayoutInflater().inflate(R.layout.info_window_map, null);
        }

        @Override
        public View getInfoContents(Marker marker) {

            //Seta a linha no infowindow
            TextView txtTitle = ((TextView)myContentsView.findViewById(R.id.cod_linha));
            txtTitle.setText(marker.getTitle());

            //Pega a informação em snippet e separa linha, codOnibus do endereço
            String snippet = marker.getSnippet();
            Snippet snp = new Snippet();
            snp.fillSnippet(snippet);

            TextView txtCodLinha = ((TextView)myContentsView.findViewById(R.id.cod_linha));
            txtCodLinha.setText(snp.getLinha());

            TextView txtCodOnibus = ((TextView)myContentsView.findViewById(R.id.cod_onibus));
            txtCodOnibus.setText(snp.getCodOnibus());

            TextView txtPrevisao = ((TextView)myContentsView.findViewById(R.id.previsao));
            txtPrevisao.setText(snp.getPrevisao());

            return myContentsView;
        }

        @Override
        public View getInfoWindow(Marker marker) {
            // TODO Auto-generated method stub
            return null;
        }
    }

0 个答案:

没有答案