相关疑难解决方法(0)

如何将drawable作为背景放在InfoWindow(Google Maps API v2 for Android)上?

这是我的信息窗口的自定义布局:

<RelativeLayout 
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/bg_infowindow" >
    <LinearLayout
            android:id="@+id/text_box"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical" >
        <TextView 
            style="@style/TexTitle"
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    <TextView 
            style="@style/TextDistance"
            android:id="@+id/distance"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

这是我的自定义适配器:

public class MapInfoWindowAdapter implements InfoWindowAdapter{

    private LayoutInflater inflater;
    private Context context;

    public MapInfoWindowAdapter(Context context){
        inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
        this.context = context;
    }

    @Override
    public View getInfoContents(Marker marker) {

        // Getting view from the layout file
        View v = inflater.inflate(R.layout.map_popup, null);

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

        TextView address = (TextView) …
Run Code Online (Sandbox Code Playgroud)

android google-maps-android-api-2

21
推荐指数
1
解决办法
1万
查看次数

适用于Android的Googlemaps v2中的getInfoWindow()和getInfoContents()之间的区别

两个问题:

  1. 是什么区别public abstract View getInfoWindow (Marker marker)public abstract View getInfoContents (Marker marker).

  2. getInfoContents()的用途是什么.

Google地图博客说:( getInfoWindow())允许您提供将用于整个信息窗口的视图.(getInfoContents())允许您只定制窗口的内容,但仍保留默认信息窗口框架和背景..可以任何一个请expalin(尝试与现有项目比较,可能像listView行项目左右)

谢谢

android infowindow marker google-maps-android-api-2

13
推荐指数
1
解决办法
7004
查看次数

如何更改google maps api v2的自定义InfoWidnow形状

现在我使用此代码显示默认的矩形形状.

 this.infoWindow = (ViewGroup)getLayoutInflater().inflate(R.layout.newcustomdialog, null);
 this.infoImage=(ImageView)infoWindow.findViewById(R.id.graphicimage);
 this.infoTitle = (TextView)infoWindow.findViewById(R.id.balloon_item_title);
 this.infoSnippet = (TextView)infoWindow.findViewById(R.id.balloon_item_snippet);
 this.close=(Button)infoWindow.findViewById(R.id.close_img_button);
 this.infoButton = (Button)infoWindow.findViewById(R.id.more);
     //
   // Setting custom OnTouchListener which deals with the pressed state
   // so it shows up 
 this.infoButtonListener = new OnInfoWindowElemTouchListener(HomeScreen.this,infoButton) 
 {
       @Override
       protected void onClickConfirmed(View v, Marker marker) {
          // v.setVisibility(View.GONE);
           // Here we can perform some action triggered after clicking the button
        Toast.makeText(HomeScreen.this, marker.getTitle() + "'s button clicked!", Toast.LENGTH_SHORT).show();
       }

 }; 
   //oraii 
 this.exitButtonListener=new OnInfoWindowExitListener(HomeScreen.this,infoWindow) {

    @Override
    protected void onClickConfirmed(View v, Marker marker) { …
Run Code Online (Sandbox Code Playgroud)

android google-maps

2
推荐指数
1
解决办法
1万
查看次数