我必須在ListView上應用分頁概念我的列表視圖包含從Web服務分析的數據。下面的代碼給出了我如何在列表視圖中顯示數據,如下所示。分頁ListView中的Android
try {
ArrayList<HashMap<String, String>> arl (ArrayList<HashMap<String, String>>) getIntent().getSerializableExtra("arraylist");
System.out.println("...serialized data.."+arl);
lv1 = (ListView) findViewById(R.id.lstlodgingresult);
adapter = new SimpleAdapter(this, arl, R.layout.custom_row_view,
new String[] { "Srno", "Names", "URL", "Address1", "Address2", "Telephone", "Category", "PetH",
"PetInfo" }, new int[] { R.id.txtSrno,R.id.txtname, R.id.txturl, R.id.txtaddress1, R.id.txtaddress2, R.id.txtphone, R.id.txtcategory,
R.id.txtpetpolicyH, R.id.txtpetpolicyC }
);
lv1.setScrollbarFadingEnabled(false);
lv1.refreshDrawableState();
lv1.setAdapter(adapter);
} catch (Exception e) {
e.printStackTrace();
}
你可以給更多的明確的想法,你所面對現在在上面的代碼是什麼問題呢? – Android
什麼是分頁? – Nallath
你好Nallath,分頁是你可以通過頁面顯示你的結果的概念。以上代碼正在工作。但它填充ListView的所有值開始我想要的是ListView默認應顯示10條記錄,當用戶向下滾動到最後一條記錄時,它將獲取下10條記錄。它應該以類似的方式工作。 – sandy