Code example for ImageView

Methods: getHeight, getLocationOnScreen, getViewTreeObserver, getWidth

0
            ViewTreeObserver observer = mImageView.getViewTreeObserver();
            observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
                 
                @Override 
                public boolean onPreDraw() { 
                    mImageView.getViewTreeObserver().removeOnPreDrawListener(this);
 
                    // Figure out where the thumbnail and full size versions are, relative 
                    // to the screen and each other 
                    int[] screenLocation = new int[2];
                    mImageView.getLocationOnScreen(screenLocation);
                    mLeftDelta = thumbnailLeft - screenLocation[0];
                    mTopDelta = thumbnailTop - screenLocation[1];
                     
                    // Scale factors to make the large version the same size as the thumbnail 
                    mWidthScale = (float) thumbnailWidth / mImageView.getWidth();
                    mHeightScale = (float) thumbnailHeight / mImageView.getHeight();
     
                    runEnterAnimation(); 
                     
                    return true; 
                }