Using jquerytools' overlay plugin (the apple style).
The problem is that the background of the verlay (this static image), and its content are in fixed size.
How can the size of the overlay be dynamically changed according to content coming from ajax?
Also if you look at their own example at http://jquerytools.org/demos/overlay/external.html, you can see that there is a static size for the overlay.
What if the contents of the external page were less that the predefined size?
Another problem related is that the scroll bar is shown even if content's height is less than container's height.
Related
I'm trying to display images in a fixed size box (the grey area in the image here). When the submit button is pressed new images will be fetched from the internet. But the images will be different sizes.
So to prevent the "submit" button moving up and down due to different size images (and potentially having it off the screen) I'd like the images to fit inside the box. (I suppose there are a few options there, for example having the image resize to fit in the box or having the image be clipped and still fitting in the box.) I've been messing with containers and columns etc for ages but nothing seems to work.
what is the best way to fit images of different sizes into a fixed size box ?
The Image widget can have a height be specified. You can read more about that here
I want to implement scrollview in Unity3D 5 UI with horizontal images downloaded from web, they have different random aspect ratios, but I want them to be constant height. And width to be according their aspect ratio, like this:
I tried to use Horizontal Layout Group, but images get too little, so it can all fit in group, when I want them to be constant height and stretch parent's width. So, like, parent's widht is primary and it affects children, but I want children to affect total parent's width (expand it when adding new children images).
Any ideas how to achieve this? Thanks.
You need to use ScrollView with horizontal scrolling enabled and vertical scrolling disabled. Setup your hierarchy as in the image below:
On the GameObject named Content attach Horizontal Layout Group and Content Size Fitter with the following settings:
Then on all your images attach a Layout Element component and during runtime calculate the width using the aspect ratio of the image and height to the Content gameobject and assign this width to Preferred Width property of Layout Element Component: In the following image 300 is the calculated width for the image:
As a result any images you add as child to the Content gameobject will increase their parent's width and also you will be able to scroll horizontally to view all the image.
p.s. I wrote this answer in a hurry. Hopefully it will make sense to you if not let me know and I will improve my answer.
I have a 700x1280 image and my design resolution is 700x1280.
I am not providing separate assets for each device that I target rather i will use one Resource which contains all my assets.
The problem:
When I set my design resolution I pass a ResolutionPolicy::FIXED_WIDTH meaning from what I understand it will scale the width with no bordering but the height may be bordered. But all I see is a fixed width but the height of the image goes out of the screen i.e it's not making the height fit in the screen like FIXED_WIDTH is supposed to do?
FIXED_WIDTH only promises to keep the width using the full physical width of the screen but doesn't promise that the height will stay the same i.e it may go out of the screen. For portrait mode FIXED_HEIGHT is the way to go because your height on any device is definitely bigger than that of the width so by using FIXED_HEIGHT the width will never go out of screen, it's a bummer but that's what you have to do!
I was just experimenting with UIStackView. In this quiz app i have different sized imaged, so i want the image to fill the space between the top button and the question text at the top. The buttons have constraints on them so they should be any size under 50px. As of now the top button is the one getting auto increased size, but that seems kinda random.
According to what I understand you have all the items inside a vertical UIstack. The images have different sizes so the available space for the buttons will changes based on the size of the image. I suggest that you add constraints to all buttons to be equal in height. This way they will re-size based on the available space but they will all have the same height.
I use a VerticalPanel as a container and add to it an Image and a Label widgets. The image widget has been set to use the 100% of the width and 80% of the height of the container. The Label widget has been set to use the 100% of the width and 20% of the height of the container.
Unfortunately, when i load two pictures (of different sizes) in two such containers that have their size fixed (width=120px height=100px - the containers a.k.a VerticalPanel), the images do not appear to have the same size on screen.
Why images appear to have different size when they are displayed on web browser?
Try using setPixelSize() to resize the image as described here: Scaling an Image in GWT