如何设置x y坐标,以便在打开imageview时图像缩放到该点?

时间:2012-09-04 04:37:33

标签: android android-layout zoom relativelayout setfocus

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

到目前为止,这是我获取地图displayingzoomingpanning的方式,而且效果很好。

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

0 个答案:

没有答案