This is a simple custom View Control Room, which can be displayed after being registered in XML.
Import android. content. context; import android. graphics. bitmap; import android. graphics. bitmapfactory; import android. graphics. canvas; import android. graphics. color; import android. graphics. paint; import android. graphics. paint. align; import android. graphics. paint. style; import android. util. attributeset; import android. view. view; public class diyview extends view {public diyview (context) {super (context); // todo auto-generated constructor stub} public diyview (context, attributeset attrs) {super (context, attrs) ;}@ overrideprotected void ondraw (canvas) {super. ondraw (canvas); // defines paint = new paint (); // sets its attribute paint. setstrokejoin (paint. join. round); paint. setstrokecap (paint. cap. round); paint. setcolor (color. red); // draw line canvas. drawline (0, 0,300, 0, paint); paint. setcolor (color. green); paint. setstyle (style. stroke); // draw a circle canvas. drawcircle (20, 80, 20, paint); paint. setstyle (style. fill); paint. setcolor (color. blue); // rectangular canvas. drawrect (0,200, 50,300, paint); paint. setcolor (color. gray); paint. settextsize (20); paint. settextalign (align. center); // text canvas. drawtext ("test", 150,150, paint); // image Bitmap bitmap = bitmapfactory. decoderesource (getresources (), R. drawable. ic_launcher); canvas. drawbitmap (bitmap, 300,300, paint); paint. setcolor (color. black); paint. setstrokewidth (40); // draw point. It looks like a circle here. It is mainly set to setstrokewidth, so it is larger than int colorfuls [] = new int [] {color. blue, color. green, color. red, color. magenta, color. black}; For (INT I = 0; I <200; I + = 40) {paint. setcolor (colorfuls [I/40]); canvas. drawpoint (200,200 + I, paint);} canvas. save ();}}