The component layout is best determined by a sibling component or parent component to determine its location coordinates. Gravity properties, which can be placed inside the component
Prompt property hint in EditText, and how to set the input format for passwords
1 <Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"2 Xmlns:tools= "Http://schemas.android.com/tools"3 Android:layout_width= "Match_parent"4 Android:layout_height= "Match_parent"5 android:padding= "15DP"6 Tools:context=". Mainactivity " >7 8 <TextView9 Android:id= "@+id/labeltext"Ten Android:layout_width= "Match_parent" One Android:layout_height= "Wrap_content" A android:gravity= "Center" - Android:text= "Login Interface" /> - the <EditText - Android:id= "@+id/usernametext" - Android:layout_below= "@id/labeltext" - Android:layout_width= "Wrap_content" + Android:layout_height= "Wrap_content" - Android:layout_alignright= "@id/labeltext" + Android:layout_alignleft= "@id/labeltext" A Android:hint= "username"/> at - <EditText - Android:id= "@+id/passwordtext" - Android:layout_below= "@id/usernametext" - Android:layout_width= "Wrap_content" - Android:layout_height= "Wrap_content" in Android:layout_alignright= "@id/usernametext" - Android:layout_alignleft= "@id/usernametext" to Android:hint= "Password" + Android:inputtype= "Textpassword"/> - the <Button * Android:id= "@+id/cancelbutton" $ Android:layout_width= "Wrap_content"Panax Notoginseng Android:layout_height= "Wrap_content" - Android:layout_below= "@id/passwordtext" the Android:layout_alignright= "@id/passwordtext" + Android:text= "Cancel"/> A the <Button + Android:id= "@+id/loadbutton" - Android:layout_width= "Wrap_content" $ Android:layout_height= "Wrap_content" $ Android:layout_toleftof= "@id/cancelbutton" - Android:layout_alignbottom= "@id/cancelbutton" - Android:text= "Log In"/> the - Wuyi </Relativelayout>
View Code
Familiar with ANDROIDAPI series 8--relativelayout comprehensive Exercises