android - Last Item of ListView cannot be displayed -
I have a list of items and EditText
ListView
, in my list There are 5 items, only 4 items are displayed on the program run below:
if (position == 0) {view = View.inflate (getActivity (), R.Lightout.it_search , Blank); Last Edited Test at_reserve = (Editing Text) view.findViewById (R.id.et_search); Return view; } Item items = items Get (position -1); Log.i (tag, "position =" + position + ", item.image () =" + items.size () + ", list.getCount () =" + list.getCount ()); .....
In this case only 4 items are displayed, and I have also logged the output:
: position = 1, Item size () = 5, list.getCount () = 6: condition = 2, item.image () = 5, list.getCount () = 6: condition = 3, items.size () = 5, list GetCount () = 6: position = 4, item. (Size =), from the list .getCount () = 6
From the output we can see that it is 4x loops and also For the position- 1
(0 to 3) it does not go to the next item, if someone knows what the problem is, please reply to the post. thank you in advanced!
get revision of
will be in your adapter
@override public int getCount () {return items.size () + 1; }
But this is not a good way. Above ListView
is a better way to add EditText
to your layout code. In this case you do not need to check the situation.
Comments
Post a Comment