I need your help !
In xamarin.forms, I would like a Label with a fixed Width. When the text is too long, it is on several lines. So, I would like set a maximum height or number of lines.
I think to measure the string lengh but I no found method.
I hope there is a solution to Xamarin.Forms (PCL project). I don't want to do specific code for each platform if it's possible.
Thank you in advance !
I found a solution.
When I set HeightRequest property to Label, it didn't work.
When I wrapped the Label in a StackLayout and set HeightRequest property to the StackLayout, I succeeded.
<StackLayout Orientation="Horizontal" HeightRequest="70">
<Label Text="..." />
</StackLayout>
you can use "MaxLines" to display how many lines you want.
There are a few options available. If you don't want the label to wrap you can set the Label.LineBreakMode to NoWrap. More info here.
You can directly specify a HeightRequest or set VerticalOptions on the Label.
Try posting a code example of what you have tried for more assistance.
Related
I am using ipywidgets to create a Dashboard with voila
I have a Textarea as follows:
comm_text = widgets.Textarea(value='',
placeholder='OK',
description='',
style=style,
layout=widgets.Layout(height="auto", width="auto"))
what I pretend with height="auto" is that when entering lines in textarea the text box expands vertically accordingly. (I want to have all the text visible)
It actually does not happend.
As you can see in the screenshot I introduced 8 lines but the textarea does not expand along.
Is that at all possible?
If not, what does actually height="auto" stand for?
If you change
layout=widgets.Layout(height="auto", width="auto")
for
layout=widgets.Layout(height="100%", width="auto")
It will resize to display all the text that it had on the value (default value for the Textarea).
However it won't grow as you type. I don't remember any textarea that does that on webpages.
One more thing. If you are using grids, with height="auto" and you resize the Textarea (dragging by the corner), it will resize other related elements of the grid.
That won't happen if you use height="100%"
The parameter height='auto' sets the CSS of the widget to 'auto'. But it has no effect for a textarea, because the number of rows are hard-coded. Jason Grout speaks of this in this Github post.
If you want a growing text area, you could use this workaround:
def get_bigger(args):
comm_text.rows = comm_text.value.count('\n') + 1
comm_text = Textarea(value='',
placeholder='OK',
description='',
rows=1,
layout=Layout(width="auto"))
comm_text.observe(get_bigger, 'value')
comm_text
Disclaimer: I don't know if this behavior is useful. You will give up control how big the textarea can get.
I'm having table content exceeding the screen width and I don't know how to fix it.
Tried to get <class="md-layout__content"> or <class="page-content"> maxwidth set to 100% of the current screen size but couldn't.
Also for left-padding the page content how should I proceed? I thought that I could add <style="padding-left: %10"> or margin maybe?
Any help is appreciated!
Thanks :)
Question Example
Please removed following property from your style sheet for Table.
then this will solved your problem.
white-space: nowrap;
removed this property from .mdl-data-table class
I'm having problems with my fixed menu. As you can see of the example beneath it's not possible to click the links "VingÄrde, Dyrkning..." because of the div box with the fixed menu on top of it. I've tried ordering the layers with z-index but I just can't get it to work. Can anybody help me out?
http://itu.dk/people/mbul/humlum/
And if anyone by the way have a method on auto adjusting the height of the page so it covers the whole viewport I would be very glad to hear from you :-) In the website version above I've set the height manually to 1000px which is not preferable
Thank you!
You need to put all the wrappers' elements outside of it and put them after the left-page container and before the right-page container. Finally, remove the wrapper, it seems unnecessary for the page in order to work.
I fixed it through Chrome's dev tools, but I assume it should work if you modify the html that way.
The body should look like this:
<div id="left_page_container">...</div>
<div class="nav_humlunvim">...</div>
<div class="nav_butik">...</div>
<div class="nav_blog">...</div>
<div class="nav_kontakt">...</div>
<div id="right_page_container">...</div>
Hope it helps; as an extra observation it is more common to use "hyphen-separated-names" for selectors than to use "snake_case_names" :)
I am using JDeveloper 11.1.2.3.0,
I have an inputFile component in my page that takes its text value from the name of some components. The problem is that that when the text is long it gets displayed all there and may even occupy the whole window. Is there any possibility to wrap this text value in this case?
I don't think <af:inputFile> has a labelStyle attribute:
You can try adding the CSS in the component's inlineStyle or contentStyle
<af:inputFile inlineStyle="word-wrap:break-word;" />
It depends if the very long text is in the content or the label of the field.
If this doesn't do the trick, you can try creating a custom skin and customizing the label or content style via the adf style selectors: af|inputFile::content , af|inputFile::label.
Btw, you need to check if word-wrap works on all browsers you're targeting.
You can try setting the labelStyle attribute of the <af:inputFile> component to wrap the contents of the label. I am not sure of the CSS style attribtue information for it, but searching on the net I found word-wrap:break-word;.
I too had this problem with af:inputFile.
Just give contentStyle="width:200px" it will solve the issue.
we can adjust the width accordingly.
I have a gwt button that has a fixed size.
I want to present a text on it, and if that text exceeds the button length, I need to cut it short and put "..." in the end. I use the following code now:
if(name.length() > 11){
//limiting the size of the text presented on the button
name = name.substring(0,10)+"...";
}
I have a list of such buttons, and this approach causes that not all button's text have the same size.
The problem is, for example, that 10 chars of "!" are much shorter than 10 chars of "A".
Can anyone help me with a way to solve this issue?
Thanks!
Fast answer. Try ussing HTML5/CSS3 property. It does exactly that:
http://www.w3schools.com/cssref/css3_pr_text-overflow.asp
If you need to do that for non-CSS3 browsers you'll need to make some kind of fake. Maybe setting a button div content, with overflow-hidden, and placing a floating "..." to the right. But it's more difficult...
You could add a style-class to all those buttons and fix their size.
Should be something like this:
First, add the style-class to each button:
Button button = new Button();
button.addStyleName("buttonSizeStandard");
Then add a matching style in the css file:
.buttonSizeStandard{
width: 200px; //change 200 to whatever
}