Theoretical part
1, ScrollView, and Horizontalscrollview are added scroll bars for controls or layouts
2. The above two controls can only have one child, but it is not a container in the traditional sense
3. The above two controls can be nested with each other
4, the position of the scroll bar now the experimental result is: can be set by Layout_width and Layout_height
5, ScrollView used to set the vertical scroll bar, Horizontalscrollview for setting the horizontal scroll bar: Note that there is a property that scrollbars can set the direction of the scroll bar: But ScrollView set to horizontal is and set to none is the effect of the same, Horizontalscrollview set to vertical and none the same.
Code practices:
1<?xml version= "1.0" encoding= "Utf-8"?>2<scrollview xmlns:android= "Http://schemas.android.com/apk/res/android"3Android:id= "@+id/mscrollview"4Android:layout_width= "Fill_parent"5android:layout_height= "Wrap_content"6android:scrollbars= "Vertical" >7 8<LinearLayout9Android:layout_width= "Fill_parent"Tenandroid:layout_height= "Wrap_content" Oneandroid:orientation= "Vertical" > A -<LinearLayout -Android:layout_width= "Fill_parent" theandroid:layout_height= "Fill_parent" -android:orientation= "Horizontal" > - -<Button +Android:id= "@+id/opennetcard" -Android:layout_width= "Wrap_content" +android:layout_height= "Wrap_content" Aandroid:layout_weight= "1" atAndroid:text= "Turn on the wireless card"/> - -<Button -Android:id= "@+id/closenetcard" -Android:layout_width= "Wrap_content" -android:layout_height= "Wrap_content" inandroid:layout_weight= "1" -Android:text= "Turn off the wireless card"/> to +<Button -Android:id= "@+id/checknetcardstate" theAndroid:layout_width= "Wrap_content" *android:layout_height= "Wrap_content" $android:layout_weight= "1"Panax Notoginsengandroid:text= "Check NIC status"/> -</LinearLayout> the +<LinearLayout AAndroid:layout_width= "Fill_parent" theandroid:layout_height= "Fill_parent" +android:orientation= "Horizontal" > - $<Button $Android:id= "@+id/scan" -Android:layout_width= "Wrap_content" -android:layout_height= "Wrap_content" theandroid:layout_weight= "1" -android:text= "Scan Network"/>Wuyi the<Button -Android:id= "@+id/getscanresult" WuAndroid:layout_width= "Wrap_content" -android:layout_height= "Wrap_content" Aboutandroid:layout_weight= "1" $android:text= "Scan results"/> -</LinearLayout> - -<LinearLayout AAndroid:layout_width= "Fill_parent" +android:layout_height= "Fill_parent" theandroid:orientation= "Horizontal" > - $<Button theAndroid:id= "@+id/connect" theAndroid:layout_width= "Wrap_content" theandroid:layout_height= "Wrap_content" theandroid:layout_weight= "1" -android:text= "Connected WiFi"/> in the<Button theAndroid:id= "@+id/disconnect" AboutAndroid:layout_width= "Wrap_content" theandroid:layout_height= "Wrap_content" theandroid:layout_weight= "1" theandroid:text= "Disconnect WiFi"/> + -<Button theAndroid:id= "@+id/checknetworkstate"BayiAndroid:layout_width= "Wrap_content" theandroid:layout_height= "Wrap_content" theandroid:layout_weight= "1" -android:text= "WiFi connection status"/> -</LinearLayout> the the<TextView theAndroid:id= "@+id/scanresult" theAndroid:layout_width= "Fill_parent" -android:layout_height= "Wrap_content"/> the</LinearLayout> the the</ScrollView>
The layout diagram is as follows:
......
public void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.main);
}
......
Android (Java) Learning Note 110:scrollview usage