该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
答案就在Adapter里面的getView方法。你做个判断,如果你想某些数据不显示,就return一个new View这样既不占用listView条目的位置,又隐藏了
@Override
public View getView(int position, View arg1, ViewGroup arg2) {
View view = View.inflate(getApplicationContext(),
R.layout.all_model_item, null);
TextView tv_test = (TextView)view.findViewById(R.id.tv_test);
Log.i("xiaoxiao",lists.get(position).getNumber()+"");
if (lists.get(position).getNumber() < 8) {
return new View(getApplicationContext());
}else{
tv_test.setText(lists.get(position).getNumber() + "");
return view;
}
}
来源:http://www.kfapk.com/thread-17-1-1.html