第一种方法:
public View getView(int position, View convertView, ViewGroup parent)
{
View view = null; if (convertView != null)
{
view = convertView;
} else
{
LayoutInflater layoutInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = layoutInflater.inflate(R.layout.item_view, null);
}
...
}
第二种方法:
public View getView(int position, View convertView, ViewGroup parent)
{
View view = null; if (convertView != null)
{
view = convertView;
} else
{
view = LayoutInflater.from(context).inflate(R.layout.item_view,null);
}
...
}
第三种方法:
public View getView(int position, View convertView, ViewGroup parent)
{
View view = null; if (convertView != null)
{
view = convertView;
} else
{
view = View.inflate(context, R.layout.item_view, null);
}
...
}