2

我有static一张地图的图像,我希望它位于地图focus/zoom上的特定点上(例如,当用户搜索特定位置时)。

到目前为止,这就是我获得 Map 的方式displayingzooming并且panning效果很好。

public class MapDisplayActivity extends Activity implements OnTouchListener {

private static final String TAG = "Touch";
// These matrices will be used to move and zoom image
Matrix matrix = new Matrix();
Matrix savedMatrix = new Matrix();

// We can be in one of these 3 states
static final int NONE = 0;
static final int DRAG = 1;
static final int ZOOM = 2;
int mode = NONE;

// Remember some things for zooming
PointF start = new PointF();
PointF mid = new PointF();
float oldDist = 1f;

public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.mappage);
  ImageView view = (ImageView) findViewById(R.id.imageView2);
  view.setOnTouchListener(this);
}

我正在RelativeLayout使用ImageView.

4

0 回答 0