+
+
+ /**
+ * Sets the selected item and positions the selection y pixels from the top edge of the ListView.
+ * (If in touch mode, the item will not be selected but it will still be positioned appropriately.)
+ *
+ * @param position Index (starting at 0) of the data item to be selected.
+ * @param y The distance from the top edge of the ListView (plus padding)
+ * that the item will be positioned.
+ *
+ * @see <a href="http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4_r1/android/widget/ListView.java#ListView.setSelectionFromTop%28int%2Cint%29">Original code</a>
+ */
+ public void setSelectionFromTop(int position, int y) {
+ if (getAdapter() == null) {
+ return;
+ }
+
+ setSelection(position);
+ //setSelectionInt(position);
+
+ /*if (!isInTouchMode()) {
+ position = super.lookForSelectablePosition(position, true);
+ if (position >= 0) {
+ setNextSelectedPositionInt(position);
+ }
+ } else {
+ mResurrectToPosition = position;
+ }*/
+
+ /*
+ if (position >= 0) {
+ mLayoutMode = LAYOUT_SPECIFIC;
+ mSpecificTop = mListPadding.top + y;
+
+ if (mNeedSync) {
+ mSyncPosition = position;
+ mSyncRowId = getAdapter().getItemId(position);
+ }
+
+ if (mPositionScroller != null) {
+ mPositionScroller.stop();
+ }
+
+ requestLayout();
+ }
+ */
+ }
+