试试这个,根据你的要求修改:
@SuppressWarnings({ "deprecation" })
@Override
protected boolean onTap(int index)
{
CustomView customView=new CustomView(MyMap.this);
absMap.removeAllViews();
absMap.addView(customView);
customView.setBackgroundResource(R.drawable.maplocation1);
customView.setVisibility(View.INVISIBLE);
customView.removeAllViews();
absMap.invalidate();
customView.bringToFront();
customView.setVisibility(View.VISIBLE);
TextView tv2=new TextView(MyMap.this);
// tv2.setText(overlayItemList.get(index).getTitle());
tv2.setWidth(170);
tv2.setSingleLine(true);
tv2.setEllipsize(TruncateAt.END);
tv2.setSingleLine(true);
tv2.setSingleLine();
tv2.setTextColor(Color.WHITE);
tv2.setTextSize(14);
tv2.setTypeface(Typeface.DEFAULT_BOLD);
TextView tv1=new TextView(MyMap.this);
tv1.setSingleLine();
tv1.setWidth(170);
tv1.setSingleLine(true);
tv1.setEllipsize(TruncateAt.END);
tv1.setSingleLine(true);
tv2.setText(overlayItemList.get(index).getSnippet());
tv1.setTextColor(Color.WHITE);
tv1.setTextSize(12);
tv1.setTypeface(Typeface.DEFAULT_BOLD);
customView.setTag(overlayItemList.get(index).getTitle());
customView.addView(tv2, new AbsoluteLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT,10,5));
customView.addView(tv1, new AbsoluteLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT,10,25));
customView.setLayoutParams(new MapView.LayoutParams( 250, 100, overlayItemList.get(index).getPoint(),-125,-137, MapView.LayoutParams.MODE_MAP|MapView.LayoutParams.TOP_LEFT));
customView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v)
{
}
});
}