編輯:關於android開發
package com.zzw.testrefresh; import java.util.ArrayList; import android.app.Activity; import android.os.Bundle; import android.os.SystemClock; import android.widget.AbsListView; import android.widget.AbsListView.OnScrollListener; import android.widget.ArrayAdapter; import android.widget.ListView; public class MainActivity extends Activity implements OnScrollListener { private ArrayList<String> data; private ArrayAdapter<String> adapter; private int firstVisibleItem; private int visibleItemCount; private int totalItemCount; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); data = new ArrayList<String>(); for (int i = 0; i < 20; i++) { data.add("原有數據--" + i); } ListView mListView = (ListView) findViewById(R.id.listView); adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, data); mListView.setAdapter(adapter); mListView.setOnScrollListener(this); } @Override public void onScrollStateChanged(AbsListView view, int scrollState) { if (OnScrollListener.SCROLL_STATE_IDLE == scrollState) { if (firstVisibleItem == 0) { addTop(); } if (firstVisibleItem + visibleItemCount == totalItemCount) { addBottom(); } } } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { this.firstVisibleItem = firstVisibleItem; this.visibleItemCount = visibleItemCount; this.totalItemCount = totalItemCount; } private void addTop() { data.add(0, "頭部添加數據--" + (totalItemCount + 1)); adapter.notifyDataSetChanged(); } private void addBottom() { data.add("尾部添加數據--" + (totalItemCount + 1)); adapter.notifyDataSetChanged(); } }
showSetPwdDialog--自定義對話框,showsetpwddialog--樣式:
Android深度探索與HAL驅動開發(卷1)-- 第七章隨筆,android驅動開發應用程序、庫、內核、驅動程序的關系 從上到下,一個軟件系統可以分為
本文使用SAX來解析XML,在Android裡面可以使用SAX和DOM,DOM需要把整個XML文件
Android 手機衛士--獲取聯系人信息並顯示與回顯,android回顯前面的文章已經實現相關的布局,本文接著進行相關的功能實現 本文地址:http://www.cnb