private boolean checkBounds(TextView v, MotionEvent event) {
// 全局视图最外层一个View (the View that holds the UI)
View globalView = ...; // the main view of activity/application
DisplayMetrics dm = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(dm);
int topOffset = dm.heightPixels - globalView.getMeasuredHeight();
int[] origin = new int[2];
v.getLocationOnScreen(origin);
final int x = origin[0];
final int y = origin[1] - topOffset;
if ((event.getX() > x) && (event.getX() < (x + v.getMeasuredWidth()))) {
if ((event.getY() > y) && (event.getY() < (y + v.getMeasuredHeight()))) {
return true;
}
}
return false;
}
这个呢设计了计算notification高度
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |