Main. xml
<?xml version="1.0" encoding="utf-8"?><ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/arc_hf_search_result" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:id="@+id/arc_hf_search_item" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > </LinearLayout></ScrollView>
Archfsearchresult. Java
Public class archfsearchresult extends activity {protected static final string tag = "archfsearchresult"; private scrollview svresult; private linearlayout llitem; private string [] arraystr; private int pagecount = 0; private int resultcount = 10000; private int eachcount = 3000; private view;/** called when the activity is first created. * // @ override public void oncreate (bundle savedinstanc Estate) {super. oncreate (savedinstancestate); setcontentview (R. layout. main); svresult = (scrollview) findviewbyid (R. id. arc_hf_search_result); llitem = (linearlayout) findviewbyid (R. id. arc_hf_search_item); svresult. setontouchlistener (svlistener); view = svresult. getchildat (0); // arraystr = new string [resultcount]; for (INT I = 0; I <resultcount; I ++) {arraystr [I] = I + "";} // The First Time Add 3000 data records each time. Addresult ();} class svtouchlistener implements ontouchlistener {@ override public Boolean ontouch (view V, motionevent event) {Switch (event. getaction () {Case motionevent. action_down: break; Case motionevent. action_up: // If a listener event is triggered and content exists, and scrollview is pulled to the bottom, load the data if (svlistener! = NULL & view! = NULL & view. getmeasuredheight ()-20 <= svresult. getscrolly () + svresult. getheight () {addresult ();} break; default: break;} return false;} svtouchlistener svlistener = new svtouchlistener (); /*** add result */protected void addresult () {If (eachcount * pagecount <resultcount) {for (INT I = 0; I <eachcount; I ++) {int K = I + eachcount * pagecount; If (k> = resultcount) break; textview TV = new textview (this); TV. settext ("Hello World" + arraystr [k]); llitem. addview (TV) ;}pagecount ++ ;}}}