ListView

提升ListView运行效率

public View getView(int position, View convertView, ViewGroup parent) {
            View view;
            if (convertView==null)
            {
                view=View.inflate(getApplicationContext(),R.layout.activity_main,null);
            }else {
                view=convertView;
            }
            return view;
        }

设置ListView点击事件

listview.setOnItemClickListener(new AdaterView.OnItemClicklistener(){
public void onIntemClick(AdapterVIew parent,View view,int position long id){
}

你可能感兴趣的:(ListView)