multiline

How to center a two-line text in a TextView on Android?

倖福魔咒の 提交于 2019-12-03 09:16:46
I want to let it looks like this: | two | | lines | Here is the current layout, not working at all. <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="two\nlines" android:layout_gravity="center_vertical" android:layout_centerInParent="true"/> </RelativeLayout> Any idea? Thanks! kcoppock If you just want to center it (I'm assuming the \n is working to split the lines), just add android:gravity="center_horizontal" rather than

Ellipsize not working properly for a multiline TextView with an arbitrary maximum height

南笙酒味 提交于 2019-12-03 06:38:39
问题 I have a TextView with an unknown maximum height, which is dependent on the device's DPI/screen resolution. So, for instance, on and MDPI device this maximum height makes it possible to show only 2 lines at a time, a value that can be increased up to an undefined number. My issue is related with the ellipsize functionality. Let's suppose that a certain device allows for 4 lines to be displayed. If I manually set the maximum number of lines, like this... <TextView android:id="@+id/some_id"

Android EditText: Done instead of Enter or Word Wrap instead of Multi Line

只愿长相守 提交于 2019-12-03 06:08:18
I have a multiple line EditText that does not permit line returns. Right now I am replacing returns with some spaces as soon as they click save. Is there any way I can replace the on screen enter button with a Done button? (like it is for single line EditText) I am aware that I should still strip out returns ( \r\n|\r|\n ) because the on screen keyboard is not the only way to add them. Here is my current XML <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:minLines="3" android:gravity="left|top" android:inputType="textMultiLine|textAutoCorrect

Multiline Text in a WPF Button

二次信任 提交于 2019-12-03 04:41:34
问题 How do I get multi-line text on a WPF Button using only C#? I have seen examples of using <LineBreak/> in XAML, but my buttons are created completely programmatically in C#. The number and labels on the buttons correspond to values in the domain model, so I don't think I can use XAML to specify this. I have tried the naive approach below, but it does not work. Button b = new Button(); b.Content = "Two\nLines"; or b.Content = "Two\r\nLines"; In either case, all i see is the first line ("Two")

WPF Multiline TextBlock CenterAlignment Issue [duplicate]

删除回忆录丶 提交于 2019-12-03 04:11:51
This question already has an answer here : TextBlock.TextWrapping - how to make the text wrap so that the lines are center-aligned? (1 answer) I'm having an issue with multiline text blocks where it is not center aligning properly The text is coming like abcde\nabc This comes out abcde abc What I want is abcde abc This seems a simple thing and I would have thought that the textblock would center align like that automatically but it does not seem to. Try the TextAlignment property instead of HorizontalAlignment . First one is the alignment of text in the TextBlock , second the alignment of the

create a multi line chart using Chart.js

大憨熊 提交于 2019-12-03 02:34:55
I am trying to create a multiline chart using Chart.js I can do this for 1 line and i can do 2 lines using a fixed data structure but I cannot get multiple lines to display data passed to the data structure. here is the example usage abbreviated from chart.js website http://www.chartjs.org/docs/#getting-started var myLineChart = new Chart(ctx).Line(data); var data = { labels: ["January", "February", "March", "April", "May", "June", "July"], datasets: [ {fillColor: "rgba(220,220,220,0.2)", strokeColor: "rgba(220,220,220,1)", data: [65, 59, 80, 81, 56, 55, 40] }, {fillColor: "rgba(151,187,205,0

Multi-line user input in iOS: UITextField vs UITextView

只愿长相守 提交于 2019-12-03 01:39:44
问题 I need to show users a multi-line text input "box" with a height greater than the standard height of a UITextField . What the best or most correct approach should be?: Using a UITextField and change its height in code or by applying a certain height constraint. Using an editable UITextView . This is multi-line but it has no placeholder by default, I guess I should implement that feature in code. 回答1: UITextField is specifically one line only. Use UITextView instead for multiline text. To

How to do multiline UILabel in ios?

混江龙づ霸主 提交于 2019-12-02 17:55:58
I'm dynamically populating the title (UILabel). Sometime it's bit too long and IOS squeeze the font to fit in the width. Is there a way to do multiline with using same font size? Set adjustsFontSizeToFitWidth to NO and numberOfLines to 0. numberOfLines Docs This property controls the maximum number of lines to use in order to fit the label’s text into its bounding rectangle. The default value for this property is 1. To remove any maximum limit, and use as many lines as needed, set the value of this property to 0. If you constrain your text using this property, any text that does not fit within

Multiline Text in a WPF Button

偶尔善良 提交于 2019-12-02 17:49:45
How do I get multi-line text on a WPF Button using only C#? I have seen examples of using <LineBreak/> in XAML, but my buttons are created completely programmatically in C#. The number and labels on the buttons correspond to values in the domain model, so I don't think I can use XAML to specify this. I have tried the naive approach below, but it does not work. Button b = new Button(); b.Content = "Two\nLines"; or b.Content = "Two\r\nLines"; In either case, all i see is the first line ("Two") of the text. OR in XAML directly: <Button> <TextBlock>Two<LineBreak/>Lines</TextBlock> </Button> I

Multi-line user input in iOS: UITextField vs UITextView

痴心易碎 提交于 2019-12-02 15:08:38
I need to show users a multi-line text input "box" with a height greater than the standard height of a UITextField . What the best or most correct approach should be?: Using a UITextField and change its height in code or by applying a certain height constraint. Using an editable UITextView . This is multi-line but it has no placeholder by default, I guess I should implement that feature in code. UITextField is specifically one line only. Use UITextView instead for multiline text. To implement the placeholder in UITextView use this logic/code. First set the UITextView to contain the placeholder