Android scrollview is a scroll list control.
KeyCodeAs follows:
XML code of the configuration file:
<? XML version = "1.0" encoding = "UTF-8"?> <Scrollviewandroid: Id = "@ + ID/myscroll" xmlns: Android = "http://schemas.android.com/apk/res/android" Android: layout_width = "fill_parent" Android: layout_height = "fill_parent"> <linearlayout Android: id = "@ + ID/mylinear" xmlns: Android = "http://schemas.android.com/apk/res/android" Android: Orientation = "vertical" Android: layout_width = "fill_parent" Android: layout_height = "fill_parent"> </linearlayout> </scrollview>
Activity key code:
Private string data [] = {"Shanghai zhongrui", "zhongrui holdings", "zhongrui education", "huafang teaching aids", "yuance", "Jiangsu tenggrui Information Technology ", "Jiangsu branch", "Rugao base", "Tangshan base", "agile technology", "zhongrui International Education", "huaqi Education"}; // defines an array, storage display information @ overridepublic void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); super. setcontentview (R. layout. main); // call the default layout manager linearlayout layout = (linearlayout) findviewbyid (R. id. mylinear); // obtain the component for (INT I = 0; I <this. data. length; I ++) {// cyclically encapsulate the above information through the button component. settext (this. data [I]); // set the display text layout. addview ();}}
Interface effect: