
- The Actual image source height = 180px and width = 192px
- The ImageView is 90px width and 60 px heigth.
I want to know the Actual image height and width as how it is being displayed on the screen. Can somebody help me?
i tried the following but it didn't gave me the results i was looking for
- if i do imageview.getWidth i get the 90px of the ImageView
- if i do the imageView.getMeasuredWidth i get the 90px of the ImageView
- if i do imageview.getDrawable.getIntrinsicWidth i get the actual source width of 192px
- if i do imageview.getDrawable.getBounds i get the actual source width of 192px
- if i retrieve the bitmap and do getScaledWidth(metrics) i get the actual asource width of 192px
You can try something like this:
- you have Image height (IH) and image width (IW)
- find ImageView height (H).
- find the top padding (TP) and bottom padding (BP) for the ImageView
- your displayed image height is DIH = H - (BP + TP)
- displayed image width DIW = (IW * DIH) / IW;
I hope I understand your question.