Mit*_*hah 2 android android-camera android-canvas
我创建了一个应用程序.在我是随机产生latitude,并longitude在GoogleMap并通过该值下页..即CameraPage.但是,在CameraPage上,引脚没有像地图上那样正常掉落..我已经实现了camera-zoom其他方法,但仍然无法正常工作..
请检查屏幕截图..
MapPage

CameraPage

是否有任何解决方案可以缩放相机上的引脚而无需外部变焦控制?
它应该在CameraPage加载时默认缩放..
编辑::
码::
ArrayList<Point> props = new ArrayList<Point>();
props.add(new Point(a_latitude, a_longitude, a_username));
props.add(new Point(b_latitude, b_longitude, b_username));
props.add(new Point(c_latitude, c_longitude, c_username));
props.add(new Point(d_latitude, d_longitude, d_username));
props.add(new Point(e_latitude, e_longitude, e_username));
props.add(new Point(f_latitude, f_longitude, f_username));
props.add(new Point(g_latitude, g_longitude, g_username));
props.add(new Point(h_latitude, h_longitude, h_username));
props.add(new Point(i_latitude, i_longitude, i_username));
props.add(new Point(j_latitude, j_longitude, j_username));
mPaint.setColor(Color.BLACK);
mPaint.setTextSize(30);
mPaint.setStrokeWidth(DpiUtils.getPxFromDpi(getContext(), 2));
mPaint.setAntiAlias(true);
mSpots = new Bitmap[props.size()];
for (int i = 0; i < mSpots.length; i++)
mSpots[i] = BitmapFactory.decodeResource(context.getResources(), R.drawable.google_pin_new);
Run Code Online (Sandbox Code Playgroud)
点类::
public class Point {
public double longitude = 0f;
public double latitude = 0f;
public String description;
public Point(double d, double e, String string) {
// TODO Auto-generated constructor stub
this.latitude = d;
this.longitude = e;
this.description = string;
}
}
Run Code Online (Sandbox Code Playgroud)
而不是使用经度和纬度来绘制你的积分.
使用该功能toScreenLocation.例如,以下行将返回一个Point表示您应该绘制位置标记的坐标.
android.graphics.Point p = mMap.getProjection().toScreenLocation(location);
props.add(new Point(p.X, p.Y, a_username));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
263 次 |
| 最近记录: |