My app want to show some views at specific location on a imageview,the size of the picture may beyond the screen,it also can move and scale.The key is marked view should be consistent with the imageview,but size is not scaled.just like marker on Google map。
1 Firstly,i use FrameLayout.addView(view, LayoutParam),but the point i marked is relative to the screen,not the imageview.
2 Then I put the marked view in the imageview with Canvas,but the marked view is scaled with imageview,the code is
ziv = (MyZoomImageView) findViewById(R.id.imageView); ziv.setScaleType(ImageView.ScaleType.CENTER); Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.mipmap.iv_test).copy(Bitmap.Config.ARGB_8888, true); ziv.setImageBitmap(bitmap); // put the imageview as a canvas Canvas canvas = new Canvas(bitmap); bm_click_on = BitmapFactory.decodeResource(getResources(),> R.mipmap.iv_sandmap_building_on); bm_click_off = BitmapFactory.decodeResource(getResources(), R.mipmap.iv_sandmap_building_off); mPaint = new Paint(); canvas.drawBitmap(bm_click_on, 200, 200, mPaint);// add marked view canvas.drawBitmap(bm_click_off, 950, 400, mPaint);// add marked view