android.widget.ListView.getLocationOnScreen()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中android.widget.ListView.getLocationOnScreen()方法的一些代码示例,展示了ListView.getLocationOnScreen()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListView.getLocationOnScreen()方法的具体详情如下:
包路径:android.widget.ListView
类名称:ListView
方法名:getLocationOnScreen

ListView.getLocationOnScreen介绍

暂无

代码示例

代码示例来源:origin: k9mail/k-9

/**
 * Handle a select or unselect swipe event.
 *
 * @param downMotion
 *         Event that started the swipe
 * @param selected
 *         {@code true} if this was an attempt to select (i.e. left to right).
 */
private void handleSwipe(final MotionEvent downMotion, final boolean selected) {
  int x = (int) downMotion.getRawX();
  int y = (int) downMotion.getRawY();
  Rect headerRect = new Rect();
  listView.getGlobalVisibleRect(headerRect);
  // Only handle swipes in the visible area of the message list
  if (headerRect.contains(x, y)) {
    int[] listPosition = new int[2];
    listView.getLocationOnScreen(listPosition);
    int listX = x - listPosition[0];
    int listY = y - listPosition[1];
    int listViewPosition = listView.pointToPosition(listX, listY);
    toggleMessageSelect(listViewPosition);
  }
}

代码示例来源:origin: stackoverflow.com

int childCount = mListView.getChildCount();
int[] listViewCoords = new int[2];
mListView.getLocationOnScreen(listViewCoords);
int x = (int) motionEvent.getRawX() - listViewCoords[0];
int y = (int) motionEvent.getRawY() - listViewCoords[1];

代码示例来源:origin: hudomju/android-swipe-to-dismiss-undo

@Override
public void getLocationOnScreen(int[] locations) {
  mListView.getLocationOnScreen(locations);
}

代码示例来源:origin: shixinzhang/ShixinDesignPattern

@Override
  public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    //获取在屏幕的位置
    int[] xy = new int[2];
    mListView.getLocationInWindow(xy);
    System.out.println("tvItem in window location x:" + xy[0] + " / y:" + xy[1]);
    mListView.getLocationOnScreen(xy);
    System.out.println("tvItem on screen location x:" + xy[0] + " / y:" + xy[1]);
  }
}

代码示例来源:origin: com.jayway.android.robotium/robotium-core

ListView listView = viewFetcher.getCurrentViews(ListView.class).get(listIndex);
int[] xy = new int[2];
listView.getLocationOnScreen(xy);
      .getDefaultDisplay().getWidth() / 2;
  drag(x, x, yStart, yEnd, 40);
  listView.getLocationOnScreen(xy);

代码示例来源:origin: stackoverflow.com

int childCount = listView.getChildCount();
int[] listViewCoords = new int[2];
listView.getLocationOnScreen(listViewCoords);
int x = (int) event.getRawX() - listViewCoords[0];
int y = (int) event.getRawY() - listViewCoords[1];

代码示例来源:origin: ajnas/WiFiPS

int childCount = mListView.getChildCount();
int[] listViewCoords = new int[2];
mListView.getLocationOnScreen(listViewCoords);
int x = (int) motionEvent.getRawX() - listViewCoords[0];
int y = (int) motionEvent.getRawY() - listViewCoords[1];

代码示例来源:origin: wirasetiawan29/Android

int childCount = mListView.getChildCount();
int[] listViewCoords = new int[2];
mListView.getLocationOnScreen(listViewCoords);
int x = (int) motionEvent.getRawX() - listViewCoords[0];
int y = (int) motionEvent.getRawY() - listViewCoords[1];

代码示例来源:origin: stackoverflow.com

int childCount = mListView.getChildCount();
int[] listViewCoords = new int[2];
mListView.getLocationOnScreen(listViewCoords);
int x = (int) motionEvent.getRawX() - listViewCoords[0];
int y = (int) motionEvent.getRawY() - listViewCoords[1];

代码示例来源:origin: SMSTicket/sms-ticket

int childCount = mListView.getChildCount();
int[] listViewCoords = new int[2];
mListView.getLocationOnScreen(listViewCoords);
int x = (int) motionEvent.getRawX() - listViewCoords[0];
int y = (int) motionEvent.getRawY() - listViewCoords[1];

相关文章

ListView类方法