Android Question How to present an image in an imageview without loss of proportion

vecino

Well-Known Member
Licensed User
Longtime User
Hi, I need to display many images of different sizes, but the imageview has a fixed size chosen by the user.
All images are large, but the imageview is small.
It is similar to a catalog.
The problem is that they must be displayed whole, and without losing proportion.
What do you advise me?
Thank you.

In this case I have scaled them to a fixed size, but the user will be able to change the size of each item, bigger or smaller, and what I want is that the images are always displayed well, whatever the size of the imageview.
 
Last edited:

vecino

Well-Known Member
Licensed User
Longtime User
I don't know if I'm wrong, but I think I read in some thread that you can't add at runtime a b4ximageview to a panel. or did I dream it?
I mean I thought you couldn't do something like that:
B4X:
dim p as panel
p.initialize("p")
p. ...
dim iv as b4ximageview
iv.initialize(null, "iv")
p.addview(iv, ... )
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Thanks, I did not know XUIViewsUtils.
What about adding the view to a panel?
B4X:
Dim p As Panel
p.Initialize("p")
Dim iv As B4XImageView = XUIViewsUtils.CreateB4XImageView
p.AddView(iv,0,0,p.Width,p.Height)  ' <-- Types do not match. (warning #22)

 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…