本人想定义一个适配器,里面只放一张图片,当页面没有数据时,显示本人定义的适配器里的图片,本人应该怎么定义?
这是本人的部分代码:
这是本人的部分代码:
public class NoDataAdapter extends ArrayAdapter{
private View view;
public NoDataAdapter(Context context, int resource) {
super(context, resource);
// TODO Auto-generated constructor stub
}
public View getView(int position, View convertView, ViewGroup parent) {
view = LayoutInflater.from(getContext()).inflate(R.layout.nodata, null);
return view;
}
}
解决方案
20
那适配器中就不用怎么定义的,R.layout.nodata中就放张图片就可以了,还有别的需求?