reprinted from: Http://www.cnblogs.com/loulijun/archive/2012/10/17/2727580.html
Chinese translation is the meaning of the baseline, seemingly simple and some difficult to understand, in fact, this baseline equivalent to write text in the notebook at the bottom of the line, in the relativelayout baseline example:
For example, add two adjacent TextView, give the second TextView a larger padding (such as 20DP), if added layout_alignbaseline to the second TextView, the text in TextView " World "will be at the same level as" Hello "in the first TextView, and the second TextView control is moved up, as if" Hello "and" world "are on the same line, and if there is no add layout_alignbaseline, specifically see below
<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/text1" android:text= "Hello" android:background= "#aa0000" android:layout_width= "wrap_content" android:layout_height= "wrap_content" /> <textview android:text= "World" android:background= "#00ff00" android:padding= "20DP" android:layout_ Width= "Wrap_content" android:layout_height= "wrap_content" android:layout_torightof= "@id/text1" Android:layout_alignbaseline= "@id/text1" /></relativelayout>
1: Not added Layout_alignbaseline
2: Add Layout_alignbaseline, like two lines of text Hello World written on a line
3: Test the vertical aspect, set the second TextView to the Layout_below property, without adding a layout_alignbaseline
4, test the vertical aspect, the second TextView set to the Layout_below property, plus layout_alignbaseline. As you can see, it overrides the above control, but it's not centered vertically.
What is the baseline in Android:relativelayout?