Skip to content Skip to sidebar Skip to footer

Is It Possible To Resize The Canvas In Android?

[android] I have a LinearLayout which contains 2 views, 1st is imageView and th 2nd one have canvas on it. if I do mLinearLayout.addView(i); and then mLinearLayout.addView(c); it s

Solution 1:

Give the following a try.

Take your draw statement out of ondraw then call DrawView or some shape or what ever.

//some shape// 

Also I Dont See your X And Y, or height or width.

publicDrawView(Context context) {     
    super(context);
    setFocusable (true); //necessary for getting the touch events
     mDrawable = newShapeDrawable(newOvalShape());
     mDrawable.getPaint().setColor(0xff74AC23);

     mDrawable.setBounds(x, y, x + width, y + height);  
     mDrawable.draw(canvas); 
}  

Post a Comment for "Is It Possible To Resize The Canvas In Android?"