我试图在弹出窗口中获取View的位置,但View.getX()方法返回0.0 我试图将removeAdsIm视图的位置设置为textCheck视图
public void showAdsOfferPopup(View v, Activity activity) {
if (!getInAppBillingStatus()) {
int width = display.getWidth(); // deprecated
int height = display.getHeight();
final PopupWindow popup = new PopupWindow(context);
final View layout = activity.getLayoutInflater().inflate(R.layout.popup_ads_offer_new, null);
.....
textCheck = (ImageView) layout.findViewById(R.id.popupAdsOffer_checkTestIm);
removeAdsIm = (ImageView) layout.findViewById(R.id.popupAdsOffer_removeAdsIm);
playInBackgroundIm = (ImageView) layout.findViewById(R.id.popupAdsOffer_playInBackgroundIm);
popup.setContentView(layout);
........
popup.showAtLocation(v, Gravity.CENTER, 0, 0);
int test1[] = new int[2];
removeAdsIm.getLocationOnScreen(test1);
textCheck.setVisibility(View.VISIBLE);
removeAdsIm.getX();
removeAdsIm.getY();
playInBackgroundIm.getX();
playInBackgroundIm.getY();
textCheck.setX(180);
textCheck.setY(280);
}