1)getView(int View ViewGroup )方法的写法以及三中获取打气筒服务的方式
public View getView(int i, View view, ViewGroup viewGroup) {
//想办法吧 自己创建的布局 转化成一个View对象
View v;
if (view == null){
//创建一个View对象 可以通过打气筒(inflate)把一个布局文件文件转化成View对象
//【☆☆☆☆】第一种获取打气筒服务的方式
//第一个参数上下文 第二个想转化的布局文件 第三个为ViewGroup一般不用写null
//v=View.inflate(getApplicationContext(),R.layout.item,null);
//【☆☆☆☆】第二种获取打气筒服务的方式
//v=LayoutInflater.from(getApplicationContext()).inflate(R.layout.item,null);
//【☆☆☆☆】第三种获取打气筒服务的方式
LayoutInflater inflater=(LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
v=inflater.inflate(R.layout.item,null);
}else{
v=view;
}
return v;
}
2)ListView 的入门及优化