Note that there are some explanatory texts on larger screens.

plurals
  1. POZooming and Panning of view in android
    text
    copied!<p>Hi friends I am creating one app where i put two views. first is imageview and the other one is my customeview.</p> <p>i am drawing image on my custom view. my custom view code is as follow</p> <pre><code>public class DrawView extends ImageView{ @SuppressWarnings("unused") private static final String TAG = "DrawView"; Painter painter = new Painter(); PathStack pathStack; private DrawApplication drawApplication; public DrawView(Context context, AttributeSet attr) { super(context,attr); setFocusable(true); setFocusableInTouchMode(true); drawApplication=(DrawApplication)context.getApplicationContext(); pathStack=drawApplication.getPainter().getPathStack(); painter=drawApplication.getPainter(); setScaleType(ScaleType.MATRIX); } @Override public void onDraw(Canvas canvas) { float scaleFactor=drawApplication.getScaleFactor(); canvas.scale(scaleFactor, scaleFactor,(float)getWidth()/2,(float)getHeight()/2); List&lt;DrawingPath&gt; currentStack=pathStack.getCurrentStack(); for (DrawingPath drawPath : currentStack) { drawPath.draw(canvas, painter); } } } </code></pre> <p>many things clear from code like storing path on drawapplication etc.</p> <p>now we have decided to provide zooming and panning to this view. and my drawing should also be zoomed accordingly along with imageview which in back.</p> <p>also i should be able to draw correctly.</p> <p>I tried canvas scaling but that is worst, because after scaling i am not able to draw to the touched point and also less drawing to the screen resulting in more drawing to the view.</p> <p>drawing on widget is also very lengthy task results in performance slow down. plz provide any way.</p> <p>and also i am using api level 10.</p> <p><strong>Edit1</strong></p> <p>Well friends. i got one idea. i have to draw path on different zoom level. so if we can calculate path ratio in different zoom level than it will solve my problem. plz provide help accordingly</p> <p><strong>Edit2</strong></p> <p>if we will be able to scale path then it can solve my problem</p> <p><strong>Edit3</strong></p> <p>i think if we draw it on bitmap than i can achieve my goal, but my problem is resizing bitmap and providing scrolling to bitmap on different zoom level</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload