android.widget.ListView#getLocationOnScreen ( )源码实例Demo

下面列出了android.widget.ListView#getLocationOnScreen ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: UltimateAndroid   文件: ListBuddiesLayout.java
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;
        }
    }
}
 
源代码2 项目: UltimateAndroid   文件: ListBuddiesLayout.java
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;
        }
    }
}
 
源代码3 项目: ListBuddies   文件: ListBuddiesLayout.java
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;
        }
    }
}