<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<TextView
android:id="@+id/showAddr"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="选择地点"
android:textSize="20dp"
/>
<com.baidu.mapapi.map.MapView
android:id="@+id/bmapsView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true" />
</LinearLayout>
public class MyIcon extends View {
public static int w;
public static int h;
public static Bitmap mBitmap;
public MyIcon(Context context) {
super(context);
mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.me);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
w = this.getWidth() / 2 - mBitmap.getWidth() / 2;
h = this.getHeight() / 2 - mBitmap.getHeight() / 2;
canvas.drawBitmap(mBitmap, w, h, null);
}
}
public class MyIcon2 extends View{
public static int w;
public static int h;
private Bitmap mBitmap;
public MyIcon2(Context context) {
super(context);
mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.jiewo);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
w = this.getWidth() / 2 - mBitmap.getWidth() / 2;
h = (this.getHeight() / 2 - mBitmap.getHeight() / 2) - ( MyIcon.mBitmap.getHeight()/2);
canvas.drawBitmap(mBitmap, w, h, null);
}
}