public class CustomView extends ImageView{
public CustomView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public CustomView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomView(Context context) {
super(context);
}
boolean drawGlow = false;
//this is the pixel coordinates of the screen
float glowX = 0;
float glowY = 0;
//this is the radius of the circle we are drawing
float radius = 20;
//this is the paint object which specifies the color and alpha level
//of the circle we draw
Paint paint = new Paint();
{
paint.setAntiAlias(true);
paint.setColor(Color.WHITE);
paint.setAlpha(50);
};
gordon iam confuse about draw technical if in view i can make extension. that i take from android studio code. please teach me how make draw extension or other sample draw
vknow360 please give me simple code in a view i want make drawa circle. cause if use view getview() become error. what should code use for draw for target a view
Create a class extending View.
Override onDraw() method to get Canvas object.
Draw circle on this canvas with code.
Now add a method in your extension to get HVArrangement as container.
Cast ViewGroup to this arrangement.
Create a new instance of view class you created.
Add this instance as child to viewgroup.
That’s it.