私はマップのアプリケーションを開発しています。私はそれを表示するGoogleマップとオーバーレイアイテムをit.nowに入れています。オーバーレイアイテムのタップでカスタムダイアログが必要です。簡単に実装する??custome dialogue itemizeoverlayのタップオン
おかげ ニック
私はマップのアプリケーションを開発しています。私はそれを表示するGoogleマップとオーバーレイアイテムをit.nowに入れています。オーバーレイアイテムのタップでカスタムダイアログが必要です。簡単に実装する??custome dialogue itemizeoverlayのタップオン
おかげ ニック
は
private void displaySearchResultBubble() {
//Hide the bubble if it's already showing for another result
mapView.removeView(bubble);
bubble.setVisibility(View.GONE);
///
GeoPoint point11 = item.getPoint();
///
//Set some view content
venueName.setText("Your Message");
MapView.LayoutParams params = new MapView.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
point11, MapView.LayoutParams.BOTTOM_CENTER);
bubble.setLayoutParams(params);
mapView.addView(bubble);
mapView.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
Runnable r = new Runnable() {
public void run() {
Animation fadeIn = AnimationUtils.loadAnimation(mContext, R.anim.fadein);
bubble.setVisibility(View.VISIBLE);
bubble.startAnimation(fadeIn);
}
};
//This projection and offset finds us a new GeoPoint slightly below the actual OverlayItem,
//which means the bubble will end up being centered nicely when we tap on an Item.
Projection projection = mapView.getProjection();
Point p = new Point();
projection.toPixels(point11, p);
p.offset(0, -(bubble.getMeasuredHeight()/2));
GeoPoint target = projection.fromPixels(p.x, p.y);
//Move the MapView to our point, and then call the Runnable that fades in the bubble.
mapView.getController().animateTo(target, r);
}
です
とあなたのバブルは
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="62dip"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:layout_width="185dip"
android:layout_height="wrap_content"
android:id="@+id/venuename"
android:gravity="center_vertical"
android:singleLine="true"
android:hint="Hello"
android:textSize="26px"
>
</TextView>
</LinearLayout>
</RelativeLayout>
が
LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
bubble = (RelativeLayout) inflater.inflate(R.layout.bubble, mapView, false);
venueName = (TextView) bubble.findViewById(R.id.venuename);
あなたはそれが完全なソリューション
であなたの答えを得た願って作成し、あなたの上でこれを加える方法であり、チェック次のデモ:この
@Override
protected boolean onTap(int index)
{
item = mOverlays.get(index);
displaySearchResultBubble();
return true;
}
及び方法のようなあなたの過度クラスのコールのONTAP mathodで
http://eagle.phys.utk.edu/guidry/android/mapOverlayDemo.html