开发者

Issues with Android ImageView

开发者 https://www.devze.com 2023-03-29 18:08 出处:网络
I have an application which allows the user to upload pictures from gallery or take photos using camera. everything works fine, but when i display the bitmap in the image view, the image view will be

I have an application which allows the user to upload pictures from gallery or take photos using camera. everything works fine, but when i display the bitmap in the image view, the image view will be bigger then the required size, trying to fill the parent even if i had set it's layout para开发者_运维技巧ms to wrap content.

why is this so?


You need to use BitmapFactory to resize the bitmap after calling view.layout() and view.measure() on the ImageView you're using. Use the view.getWidth() and view.getHeight() as the desired width and height, respectively, for the BitmapFactory resize procedure.


Is your ImageView inside a ScrollView container? If it is, set fillViewPort to FALSE. Check also width and height of Layout container, should be WRAP_CONTENT also.

0

精彩评论

暂无评论...
验证码 换一张
取 消