Is there a way to add views to ItemizedOverlays in android maps? If there is a way please tell me how to.. thank you..
When ever i tap on a marker i want to display its info with images, text and buttons.. I tried many answers in this community, but they all do not match my requirement. So i want to add a view with images, text and buttons to the o开发者_StackOverflow中文版verlay so that it will work good even when the maps are zoomed or moved..
You can do it in onTap method.
protected boolean onTap(final int index) {
this.index=index;
OverlayItem item = mOverlays.get(index);
dialog = new AlertDialog.Builder(mContext);
final AlertDialog dial=dialog.create();
dial.show();
dial.setContentView(R.layout.showoverlay);
Window win=dial.getWindow();
TextView tv=(TextView)win.findViewById(R.id.tvLayTitle);
tv.setText(item.getSnippet());
mBtnDel=(Button)win.findViewById(R.id.tvLayClose);
mBtnView=(Button)win.findViewById(R.id.tvLayAction);
mBtnView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(mContext,DetailProperty.class);
intent.putIntegerArrayListExtra("detailId",mAlist);
mContext.startActivity(intent);
dial.dismiss();
}
});
mBtnDel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dial.dismiss();
}
});
return true;
}
On clicking on view button just call ur activity with images and buttons.... Hope it will useful for you...
I do this:
1) Add the mapview into a RelativeLayout
2) Add the View I want to place over the overlay into the same RelativeLayout
3) Override the "draw" method of the Overlay (using a CustomOverlay class that extends Overlay). Inside the method, call a handler that repositions the View
精彩评论