I need to make the tv stretch to 100% of the height of the parent view. If I add an upper and lower constraint - the parent view narrows to the size of the textview
I tried to align the vertical center and make the height equal - the same problem
Related
I was reading an article explaining the css properties width and max-width and came across this example:
img {
width: 100%;
max-width:700px;}
This says that the fixed width of the image, should take up the entire size of the parent element — if the width of the parent element is explicitly stated, — all hundred percent of it, yet the image should never exceed 700px. It means that the image can be less than 700px, if that suits its situation better (e.g smaller window size) but it should never be more. So there are two conditions here, that the width of the image can be 100% of the parent element if it wants to but it must not never be more than 700px.
But isn't it unnecessary to add the width:100% here? Doesn't max-width:700px imply that the width will be 100% if the parent is less than 700px anyway?
First, width defines the width of a specific element while max-width define the maximum size the element is allowed to have.
Second, width:100% use the parent's width to calculate the current width value whereas max-width:100% use its own original width to calculate the maximum size. So, the image with width: 100% could be larger its original size (scaled base on its parent width). On the other hand, the image with max-width: 100% could be smaller but never be scaled larger its original size (maximum valid width = 100% x original width). That's why it's called fluid image.
Let's say you put width: 700px for an image. When you re-size your screen the image stays stably 700px. Let's say you on a mobile phone and its screen width is less then 700px the image will not fit in the screen. So it will stretch out your page and make it not mobile-friendly. At the same time, when you set max-width:700px it will re-size up to 700px but when the screen goes smaller and the images don't fit in the screen it will automatically re-size it to fit the screen.
As far I understand you want to get the image fit to the size of its parent container with the constraint of not exceeding the width of the image more than 700px.
Then I will say yes it is unnecessary to give "width: 100%;" either way default value for width will get selected i.e. "auto".
Because of this whenever your parent container will be smaller than 700px, your image will fit your container (since "width: auto;").
P.S.-Please refer "object-fit: contain" property of CSS, as that will also help.
As in Android there is an option called match-parent that fits the component's width to its parent's width.
In javaFX ,
fit to parent option is there that fits the component's width and height both to parent's width and height.
What is the replacement for match parent in JavaFX that works for width and height individually and works dynamically means if we change width of parent then component's width should be changed accrodingly.
Thanks in advance.
I have created a div resizable from two directions ie. East and West and facing following
Issues:
while stretching div component from left, the position of component is changing ie. reaching to top side of the specified container.
2.while stretching div component from right,i am able to stretch it to half of the specified container only but not the full container.
3.while repositioning the stretched div,the size of top and width are increasing inversely proportionally.
Requirement:
I want div component to resize from left and right in the same row with no increase in height or top.
Please suggest something!!
i'm trying to figure out how i could align the childs of a verticalPanel as i want.
I have a verticalPanel with 100% height which is added to center of a splitLayoutPanel.
When adding the first child in the verticalPanel it automaticaly aligns to the top.
After setting the hight of the child widget to for example 30PX and adding another child, the second one aligns to the top of the half hight of the verticalPanel.
I would like to be the second child (scrollPanel) aligned right under the first one considering the spacing and the scrollPanel should use 100% of the rest from the verticalPanel heigt.
Hope you can help me.
Try setting the height of the second cell to 100%, e.g.:
myVerticalPanel.setCellHeight(myScrollPanel, "100%");
Alternatively, you could replace the VerticalPanel by a DockPanel (or DockLayoutPanel) and add the first child north and the second child in the center.
What I think happening is this,
A vertical panel is implemented as a table when rendered, so when you set height of vertical panel to 100% it sets the height of the table to 100%. When you add an item to it, the 1st item is added to a which effectively takes up the 100% height, and inside that the added child is set to height 30px. Now when you add another child to the panel another is created. Now the vertical panel ie the table has two rows so it distributes the height equally ie 50% to reach row, hence you observe the behavior of getting added to top of half height.
A simple solution to this would be to use FlowPanel(with 10%% width and height) and have your child added to it take width as 100% and height for 1st child as 30px and 2nd child with width and height both 100%. Hope that helps you.
What value should I set for the width property of WinJS.UI.ListView so that it scales to all screen sizes and I can make the grid view layout scroll horizontally?
If I set the width property of the div for which the data-win-control is set to "WinJS.UI.ListView" to 100% then the horizontal scroll bar does not appear.
Adaptive Layout sample - http://go.microsoft.com/fwlink/p/?linkid=231571
WinJS ListView Deep Dive - http://channel9.msdn.com/Events/Build/2012/3-108
Styling a ListView - http://msdn.microsoft.com/en-us/library/windows/apps/hh850406.aspx