0

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
Cœur
  • 37,241
  • 25
  • 195
  • 267
  • @celebrate you going to make map or image move and put any marker on image ??? what does your mean ... you added code here for image and you write for google map markers ... – Amitsharma Jan 04 '16 at 12:31
  • check [this](http://stackoverflow.com/questions/1540272/android-how-to-overlay-a-bitmap-draw-over-a-bitmap) , [this](http://stackoverflow.com/questions/12235104/image-over-other-image-android) , [this](http://stackoverflow.com/questions/27734229/overlay-canvas-image-with-another-image-android) – pRaNaY Jan 04 '16 at 12:40
  • Sorry, maybe my expression is not so clear that make you misunderstanding.I mean this is a function similar to google map markers.Again, there is image on the screen, then i want to add markers in particular coordinates,also when the image is scaling, the marked view can be consistent with the picture,and keep not zoom. – xuqiang Jan 04 '16 at 13:20

0 Answers0