Sometimes, the average distribution of five textviews on the page is desired. To facilitate future use, you can write your own code as a blog to facilitate future use. The principle is to use relative layout outside the page, first, determine the first (layout_alignparenttop), third (layout_centerinparent), and fifth (layout_alignparentbottom), and then determine the second position (below the first, on the top of the third node), but if you write this statement, you will find that the second node is close to the first node, while the third node is far away, therefore, set a large relativelayout (fill_parent in width and height) outside the second layout, and then place the second one in the middle of the layout, similarly to the fourth.
Code:
<Relativelayout xmlns: Android = "http://schemas.android.com/apk/res/android" xmlns: Tools = "http://schemas.android.com/tools" Android: layout_width = "match_parent" Android: layout_height = "match_parent"> <textview Android: id = "@ + ID/mmainfirst" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: layout_alignparenttop = "true" Android: layout_centerhorizontal = "true" Android: padding = "@ dimen/padding_medium" Android: Background = "@ drawable/ic_launcher" Android: text = "first line" tools: context = ". mainactivity "/> <textview Android: Id =" @ + ID/mmainthird "Android: layout_width =" wrap_content "Android: layout_height =" wrap_content "Android: layout_centerinparent =" true "Android: padding = "@ dimen/padding_medium" Android: Background = "@ drawable/ic_launcher" Android: text = "Row 3" tools: context = ". mainactivity "/> <textview Android: Id =" @ + ID/mmainfifth "Android: layout_width =" wrap_content "Android: layout_height =" wrap_content "Android: layout_alignparentbottom =" true "Android: layout_centerhorizontal = "true" Android: padding = "@ dimen/padding_medium" Android: Background = "@ drawable/ic_launcher" Android: text = "" tools: context = ". mainactivity "/> <relativelayout Android: layout_width =" fill_parent "Android: layout_height =" fill_parent "Android: layout_below =" @ ID/mmainfirst "Android: layout_above = "@ ID/mmainthird"> <textview Android: Id = "@ + ID/mmainsecond" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: layout_centerinparent = "true" Android: padding = "@ dimen/padding_medium" Android: Background = "@ drawable/ic_launcher" Android: text = "second line" tools: context = ". mainactivity "/> </relativelayout> <relativelayout Android: layout_width =" fill_parent "Android: layout_height =" fill_parent "Android: layout_below =" @ ID/mmainthird "Android: layout_above = "@ ID/mmainfifth"> <textview Android: Id = "@ + ID/mmainfourth" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: layout_centerinparent = "true" Android: padding = "@ dimen/padding_medium" Android: Background = "@ drawable/ic_launcher" Android: text = "Row 4" tools: context = ". mainactivity "/> </relativelayout>
Effect: