First, Layout introduction
Second, test linear_layout
1.activity_main.xml
<?xml version= "1.0" encoding= "Utf-8"? ><linearlayout xmlns:android= "http://schemas.android.com/apk/res/ Android " android:layout_width=" match_parent " android:layout_height=" match_parent " android:o rientation= "Horizontal" > <textview android:layout_width= "wrap_content" android:layout_height = "Wrap_content" android:background= "#ff0000" android:text= "first"/> <textview android: Layout_width= "Wrap_content" android:layout_height= "wrap_content" android:background= "#0000ff" Android:text= "a second"/></linearlayout>
2.mainactivity.java
@Override protected void onCreate (Bundle savedinstancestate) { super.oncreate (savedinstancestate); Setcontentview (r.layout.activity_main); Setcontentview (r.layout.first_layout);
Android_mars Study Notes _s01_003layout Preliminary