Introduction to Android Views and Custom Views
Introduction to Android Views and Custom Views
Android offers various UI components like Buttons, TextViews, and ImageViews. But sometimes, you might need a custom view.
Creating a Custom View
public class CustomView extends View {
public CustomView(Context context) {
super(context);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Paint paint = new Paint();
paint.setColor(Color.BLUE);
canvas.drawRect(0, 0, getWidth(), getHeight(), paint);
}
}
Comments
Post a Comment