I want to display a list of items and an EditText at top of ListView, my list has 5 items, when run the program just shows 4 items. The code is below:
if(position == 0) {
view = View.inflate(getActivity(), R.layout.item_search, null);
final EditText et_search = (EditText) view.findViewById(R.id.et_search);
return view;
}
Item item = items.get(position-1);
Log.i(TAG, "position="+position+", items.size()="+items.size()+", list.getCount()="+list.getCount());
.....
In this case only shows 4 items, and also i Loged the output:
: position=1, items.size()=5, list.getCount()=6
: position=2, items.size()=5, list.getCount()=6
: position=3, items.size()=5, list.getCount()=6
: position=4, items.size()=5, list.getCount()=6
from the output we can see that it loops 4 times and also position-1 (from 0 to 3) it dosen't go to the next item, if anyone knows what is the problem please reply the post. Thanks in advance!
0 comments:
Post a Comment