It seems simple and difficult to understand. In fact, this baseline is equivalent to the line below when writing text in the notebook. The example of baseline in relativelayout is as follows:
For example, add two adjacent textviews and a larger padding (such as 20dp) to the second textview. If layout_alignbaseline is added to the second textview, the text "world" in textview is in the same horizontal line as "hello" in the first textview, and the second textview control is moved up, it is like "hello" and "world" are on the same line. If layout_alignbaseline is not added, see the following for details.
<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: layout_alignbaseline not added
2: Add layout_alignbaseline, just like two lines of text Hello world written online.
3: Set the second textview to the layout_below attribute in the test verticals without adding layout_alignbaseline.
4. Set the second textview to the layout_below attribute and add layout_alignbaseline. As you can see, it overwrites the above control, but it is not vertically centered.