If there is a need for this, there is a button in the top right corner of the header
1 <?XML version= "1.0" encoding= "Utf-8"?> 2 <LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android" 3 Android:layout_width= "Match_parent" 4 Android:layout_height= "Match_parent" 5 android:orientation= "vertical" > 6 <Relativelayout7 Android:layout_width= "Match_parent" 8 Android:layout_height= "45DP" 9 Android:background= "@color/pink_light"> Ten <TextView One Android:layout_width= "Wrap_content" A Android:layout_height= "Wrap_content" - Android:text= "title" - android:layout_centerinparent= "true" the /> - - <Button - Android:layout_width= "45DP" + Android:layout_height= "26DP" - Android:layout_alignparentright= "true" + Android:layout_marginright= "10DP" A android:layout_centervertical= "true" at Android:background= "@color/green_light" - Android:text= "More" - android:textsize= "12SP" - /> - </Relativelayout> - </LinearLayout>
In fact, the above example uses the relative layout of the relative parent control, centered, right, distance to the right of how many db. Of course, relative to the parent control is more, we also give you a reference, for example, we can be relative to the title of TextView as a reference
1 <?XML version= "1.0" encoding= "Utf-8"?> 2 <LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android" 3 Android:layout_width= "Match_parent" 4 Android:layout_height= "Match_parent" 5 android:orientation= "vertical" > 6 <Relativelayout7 Android:layout_width= "Match_parent" 8 Android:layout_height= "45DP" 9 Android:background= "@color/pink_light"> Ten <TextView One Android:id= "@+id/title" A Android:layout_width= "Wrap_content" - Android:layout_height= "Wrap_content" - Android:text= "title" the android:layout_centerinparent= "true" - /> - <TextView - Android:layout_width= "Wrap_content" + Android:layout_height= "Wrap_content" - Android:text= "Heading 2" + Android:layout_torightof= "@+id/title" A android:layout_centerinparent= "true" at Android:layout_marginleft= "5DP" - /> - </Relativelayout> - </LinearLayout>
This article is mainly relative reference
Android-relativelayout Layout Tips (i)