Common layout based on Android code
There are many examples of common Android layouts using XML files. But how to use code? Of course, code implementation is not necessary and is not recommended, but I think using code to implement these layouts can better understand the SDK API, so I also sort out some here and share with you.
First, take a look at the API inheritance diagram of the class corresponding to the layout:
The code implementation of common Android layouts. All layouts will correspond to related classes, which are inherited from the android.view.viewgroup class. LinearLayout and relativelayout are all in the android.widget package. In addition, tablelayout inherits from LinearLayout
The code is posted directly below.
Implementation effect diagram:
=========================================================================
Implementation effect diagram:
=========================================================================
Implementation effect diagram: