編輯:關於Android編程
對我上一篇文章進行了修改
可以點擊加載更多條數據
並且實現點擊功能
主要修改代碼:
MainActivity
package com.gz.test_listview; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.util.Log; import android.view.View; import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.Button; import android.widget.ListView; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class MainActivity extends Activity implements AbsListView.OnScrollListener,View.OnClickListener{ private int visibleLastIndex = 0; //最後的可視項索引 private int visibleItemCount; // 當前窗口可見項總數 private Button load_more; private View footView; MainActivityAdapter adapter; private ListView listview; //測試數據 private String[] title = {"商用","家用","測試","多聯","空氣能","商用","家用","測試","多聯","空氣能"}; private String[] praise = {"3","1","0","0","0","3","1","0","0","0"}; private String[] step = {"0","0","0","1","1","0","0","0","1","0"}; //將數據傳回adapter中 private List
MainAdapter
package com.gz.test_listview; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Handler; import android.os.Message; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by 390778 on 2016/11/9. */ public class MainActivityAdapter extends BaseAdapter{ private ViewHolder holder; private Context context; private Listpraise_step_num = new ArrayList (); private LayoutInflater inflater; List > listItems; /* 根據position,保存點擊的是哪一行數據,默認為false,點擊後改為true */ private Map isExist = new HashMap (); public MainActivityAdapter(Context context,List > listItems){ this.context = context; this.listItems = listItems; inflater = LayoutInflater.from(context); Log.i("listItem",listItems.toString()); init(); } private void init() { /* 為相應的數據賦值,所有的數據存儲在listItems中 position一一對應每一行數據 */ for (int i = 0;i
SeekBar 拖動條:拖動條和滾動條類似,當是拖動條可以拖動滑塊改變進度 RatingBar 星級評分條:星級評分條與拖動條相似 See
關鍵詞:藍牙硬件接口 UART PCM blueZ 版本:基於android4.2之前版本 bluez內核:linux/linux3.08系統:android/and
ZXing是谷歌的一個開源庫,可以用來生成二維碼、掃描二維碼。本文所介紹的是第一部分。首先上效果圖:ZXing相關各種文件官方下載地址:https://github.co
導語官方文檔:https://developer.android.com/training/articles/security-ssl.htmlHttps使用了數字簽名,