Android: OnDraw and associate the class with the ImageView in the xml?

The best way to achieve this is by creating a class LittleImage that Extends ImageView public class LittleImage extends ImageView { public LittleImage(Context context, AttributeSet attrs) { super(context, attrs); } @Override public void onDraw(Canvas canvas) { // Do you custom drawing here... } } Than, in your xml layout you can use: LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="fill_parent.

The best way to achieve this is by creating a class LittleImage that Extends ImageView public class LittleImage extends ImageView { public LittleImage(Context context, AttributeSet attrs) { super(context, attrs); } @Override public void onDraw(Canvas canvas) { // Do you custom drawing here... } } Than, in your xml layout you can use.

I'm trying to override the default drawing for a particular ImageView in my XML layout file. All the examples, I've seen do this using setContentView in the activity. I want to leave the main content view alone, and just handle the drawing for the one image control.

I'm at a loss on how to associate the id of the imageview with the new instantiated class to handle the OnDraw. I may very well be going about this backwards, so any help is appreciated. As you see, I've tried the imageViews getContext, but that didn't help.

How can I get this to trigger OnDraw?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions