Java Code Examples for android.widget.ListView#getLocationOnScreen()
The following examples show how to use
android.widget.ListView#getLocationOnScreen() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: UltimateAndroid File: ListBuddiesLayout.java License: Apache License 2.0 | 6 votes |
private void findViewClicked(MotionEvent event, float eventY, ListView list) { mChildCount = list.getChildCount(); mListViewCoords = new int[2]; list.getLocationOnScreen(mListViewCoords); int x = (int) event.getRawX() - mListViewCoords[0]; int y = (int) event.getRawY() - mListViewCoords[1]; View child; for (int i = 0; i < mChildCount; i++) { child = list.getChildAt(i); child.getHitRect(mRect); if (mRect.contains(x, y)) { mDownView = child; mDownEventY = eventY; break; } } }
Example 2
Source Project: UltimateAndroid File: ListBuddiesLayout.java License: Apache License 2.0 | 6 votes |
private void findViewClicked(MotionEvent event, float eventY, ListView list) { mChildCount = list.getChildCount(); mListViewCoords = new int[2]; list.getLocationOnScreen(mListViewCoords); int x = (int) event.getRawX() - mListViewCoords[0]; int y = (int) event.getRawY() - mListViewCoords[1]; View child; for (int i = 0; i < mChildCount; i++) { child = list.getChildAt(i); child.getHitRect(mRect); if (mRect.contains(x, y)) { mDownView = child; mDownEventY = eventY; break; } } }
Example 3
Source Project: ListBuddies File: ListBuddiesLayout.java License: Apache License 2.0 | 6 votes |
private void findViewClicked(MotionEvent event, float eventY, ListView list) { mChildCount = list.getChildCount(); mListViewCoords = new int[2]; list.getLocationOnScreen(mListViewCoords); int x = (int) event.getRawX() - mListViewCoords[0]; int y = (int) event.getRawY() - mListViewCoords[1]; View child; for (int i = 0; i < mChildCount; i++) { child = list.getChildAt(i); child.getHitRect(mRect); if (mRect.contains(x, y)) { mDownView = child; mDownEventY = eventY; break; } } }