If you need a completely customized view, you'll need to subclass View (the superclass of all Android views) and provide your custom sizing (onMeasure(...)) and drawing (onDraw(...)) methods:
1. Create your custom view skeleton:
This is basically the same for every custom view. Here we create the skeleton for a custom view that can draw a smiley, called SmileyView:
2. Initialize your paints:
The Paint objects are the brushes of your virtual canvas defining how your geometric objects are rendered (e.g. color, fill and stroke style, etc.). Here we create two Paints, one yellow filled paint for the circle and one black stroke paint for the eyes and the mouth:
3. Implement your own onMeasure(...) method:
This is required so that the parent layouts (e.g. FrameLayout) can properly align your custom view. It provides a set of measureSpecs that you can use to determine your view's height and width. Here we create a square by making sure that the height and width are the same:
Note that onMeasure(...) must contain at least one call to setMeasuredDimension(..) or else your custom view will crash with an IllegalStateException.
4. Implement your own onSizeChanged(...) method:
This allows you to catch the current height and width of your custom view to properly adjust your rendering code. Here we just calculate our center and our radius:
5. Implement your own onDraw(...) method:
This is where you implement the actual rendering of your view. It provides a Canvas object that you can draw on (see the official Canvas documentation for all drawing methods available).
6. Add your custom view to a layout:
The custom view can now be included in any layout files that you have. Here we just wrap it inside a FrameLayout:
Note that it is recommended to build your project after the view code is finished. Without building it you won't be able to see the view on a preview screen in Android Studio.
After putting everything together, you should be greeted with the following screen after launching the activity containing the above layout: