Hi I have an ImageView inside RelativeLayout, now how can I get X and Y position of imageview on screen ?
I have tried
getLocationOnScreen
log(mPhoto.getLeft());
log(mPhoto.getScrollX());
log(mPhoto.getX());
log(mPhoto.getTranslationX());
but all of them returns 0.
Above functions are called after progmatically setting imageview to center
RelativeLayout.LayoutParams lp1 = new RelativeLayout.LayoutParams(mFaceWidth, mFaceHeight);
lp1.addRule(RelativeLayout.CENTER_HORIZONTAL);
lp1.addRule(RelativeLayout.CENTER_VERTICAL);
mPhoto.setLayoutParams(lp1);
mPhoto.requestLayout();