**1.View中的方法getLocationOnScreen(int[] location):获取该控件在屏幕中的绝对坐标并将坐标保存在数组中:如下图所示,A为屏幕的原点,R,C点即为view的绝对坐标的位置
getLocationInWindow(int[] location) :获取控件相对于父窗口的坐标,如c在R中,获取c在R中的坐标**
2.
public void click1(View v) {
View view = View.inflate(this, R.layout.dialog, null);
//获取PopupWindow中View的宽高
view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
int measuredWidth = view.getMeasuredWidth();
int measuredHeight = view.getMeasuredHeight();
PopupWindow popupWindow = new PopupWindow(view, getResources().getDisplayMetrics().widthPixels
, getResources().getDisplayMetrics().heightPixels);
popupWindow.setFocusable(true);//popupwindow设置焦点
popupWindow.setBackgroundDr