You need to wait until the views are measured. You can use OnGlobalLayoutListener.
imageView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
public void onGlobalLayout() {
int height = imageView.getHeight();
int width = imageView.getWidth();
int x = imageView.getLeft();
int y = imageView.getTop();
imageView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
ImageView , , , . ImageView, RelativeLayout match_parent ImageView wrap_content ImageView layout_gavity center_vertical.