Issue
Hi i want to draw a imageview into canvas in android studio
I found this code that draws a drawable but i want it to draw a imageview
Drawable drawable = getResources().getDrawable
(R.mipmap.ic_launcher);
drawable.setBounds(20, 30, drawable.getIntrinsicWidth()+20, drawable.getIntrinsicHeight()+30);
drawable.draw(canvas);
and this is what i want it to draw
ImageView thisisImg= (ImageView)findViewById(R.id.ImageView01);
how do i do that? Thanks
Solution
Simply use getDrawable()
from ImageView.
Your example would turn into:
ImageView thisisImg= (ImageView)findViewById(R.id.ImageView01);
Drawable drawable = thisisImg.getDrawable();
drawable.setBounds(20, 30, drawable.getIntrinsicWidth()+20, drawable.getIntrinsicHeight()+30);
drawable.draw(canvas);
Answered By - dragi
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.