Wednesday, July 28, 2010

[android-developers] In GridView the focus item position moved to left when we press space key to page down.

In Android when we open app using Gridview Ex. Gallery.
In device with keyboard, when we press Shift key, the focused item
will change its position to left.
Is it Android's SPEC or bug??

I checked the Gridview.java source code.
In PageScroll() function, when we press space key, it does page down.
And focused item is Math.min(mItemCount - 1, mSelectedPosition +
getChildCount() - 1);
It will plus getChildCount() which means number of one page items.
However, why does it minus 1?? it leads focus item move to left
position.

if (direction == FOCUS_UP) {
nextPage = Math.max(0, mSelectedPosition - getChildCount()
- 1);
} else if (direction == FOCUS_DOWN) {
nextPage = Math.min(mItemCount - 1, mSelectedPosition +
getChildCount() - 1);
}
if (nextPage >= 0) {
setSelectionInt(nextPage);
invokeOnItemScrollListener();
awakenScrollBars();
return true;
}

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate