Friday, January 25, 2013

Re: [android-developers] Re: android imageview stretch to background height and keep ratio

The quickest solution would be to create a custom imageview that extends imageview, and then handle the onLayout and onMeasure yourself.

On Friday, January 25, 2013 12:59:38 AM UTC-5, Greenhand wrote:
Because if I changed the two "inner" image views to match_parent, they will expand the background imageview and its parent (RelativeLayout). It did not work.
 
What I would like to do is let the inner imageviews resized automatically to "exactly match" the background. If it is smaller, it will stretch to the height of the background. If it is bigger, it will shrink to the height of the background.
 
By the way, I think the "match_parent" attribute in Android is literally misleading because it will make its parent bigger to "match_parent".
2013/1/25 Piren <gpi...@gmail.com>
if every imageview's height is wrap_content, why are you expecting them all to be the same (when all their sources are different sizes)? AdjustViewBounds isnt a magical property :)
the two "inner" imageviews should be match_parent.

it's also a good idea to define scaleType since it has the most relevancy when talking about keeping the image ratio.


 

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
 
 

No comments:

Post a Comment