1.LinearLayout
<linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android" Android:layout_width= "Match_parent" android:layout_height= "Match_parent" android:orientation= "Horizontal" > <!-- <Button --><!-- android:id= "@+ Id/button1 " --><!-- android:layout_width=" wrap _content " --><!-- android:layout_height=" Wrap_ Content " --><!-- android:layout_gravity=" Top " --><!-- android:text= "button 1" -- ><!-- /> --><!-- <button --><!-- android:id= "@+id/button2" -- ><!-- android:layout_width= "Wrap_content" -- ><!-- android:layout_height= "Wrap_content" -- ><!-- android:layout_gravity= "Center_vertical" --><!-- android:text= "Button 2" -- ><!-- /> --><!-- <Button --><!-- android: Id= "@+id/button3" --><!-- android:layout_width = "Wrap_content" --><!-- android:layout_height= "Wrap_content" --><!-- android:layout_gravity= "Bottom" --><! -- android:text= "Button 3" --><!-- /> --> <EditText android:id= "@+id/input_message" android:layout_width= "0DP" android:layout_height= "Wrap_content" android:layout_weight= "2" android:hint= "Type something" /><Button Android:id= "@+id/send" android:layout_width= "Wrap_content" android:layout_height= "Wrap_content" android:text = " Send " /> </LinearLayout>
2.RelativeLayout
<relativelayout xmlns:android= "Http://schemas.android.com/apk/res/android" Android:layout_width= "Match_parent" android:layout_height= "Match_parent" > <button android:id= "@+id/ Button3 " android:layout_width=" Wrap_content " android:layout_height= "Wrap_content" android:layout_centerinparent= "true" android:text= "button 3 " /> <button android:id= "@+id /button1 " android:layout_width=" Wrap_content " android:layout_height= "Wrap_content" android:layout_toleftof= "@id/button3" android:layout_above= "@id/button3" android:text= "Button 1" /> <Button android:id= "@+id/button2" android:layout_width= "Wrap_ Content " android:layout_height=" Wrap_content "Android:layout_ alignleft= "@id/button3" android:text= "Button 2" /> <Button android:id= "@+id/button4" android : layout_width= "wrap_content" android:layout_height= "Wrap_ Content "android:layout_toleftof=" @id/button3 "android:layout_below=" @id/button3 " android:text=" Button 4 " /> <Button android:id= "@+id/button5" android:layout_ Width= "Wrap_content" android:layout_height= "Wrap_content" android:layout_torightof= "@id/button3" android:layout_below= "@id/button3" android:text= "Button 5" /> </RelativeLayout>
3.FrameLayout
<framelayout xmlns:android= "Http://schemas.android.com/apk/res/android" android : layout_width= "match_parent" android:layout_height= "Match_parent" > <button android:id= "@+id/button3" android:layout_width= "Wrap_content" android:layout_height= "Wrap_content" android: Layout_centerinparent= "true" android:text= "Button 3" /> <imageview Android:id= "@+id/imageview" android:layout_width= "Wrap_content" android:layout_height= "Wrap_content" android:src= "@drawable/ic_ Launcher "&NBSP;&NBSP;&NBSp; /> </framelayout>
4.TableLayout
<tablelayout xmlns:android= "Http://schemas.android.com/apk/res/android" android : layout_width= "match_parent" android:layout_height= "Match_parent" android:stretchcolumns= "1" > <TableRow > < Textview android:layout_height= " Wrap_content " android:text=" account: " /> <EditText android:id= "@+id/account" android:layout_height= "Wrap_ Content "android:hint=" Input your account " /> </tablerow> <tablerow > <TextView android:layout_height= "Wrap_content" android:text= "Password:" / > <edittext android:hint= "@+id/password" android:layout_height= "Wrap_content" android:inputtype= "TextPassword" /> </tablerow > <TableRow> <button android:id = "@+id/button" android:layout_height= "Wrap_content" android:layout_span = "2" android:text= "Login" /> </TableRow> </TableLayout>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/4F/F7/wKiom1RiCY6gjfXgAACtbJW4dfo055.jpg "title=" QQ picture 20141111210534.jpg "alt=" Wkiom1ricy6gjfxgaactbjw4dfo055.jpg "/>
Android Self-study note 2-layout