1

I have a gallery that displays a picture and a subtitle (TextView).

Now the text is broken into multiple lines if the text is long enough (correct, up to three lines) but our marketing department insists that I do not break words separated by a hyphen (e.g. "This is a double-word line" can be broken anywhere but on "double-word"). Problem is that Android tends to put the breaks exactly there :-)

Is there a way to set line break modes? Or any other idea that prevents those sentences from being broken into multiple lines?

One further thing: I use a coverflow effect and it really needs to be very smooth (which it is) for our marketing people to be happy. Which means that I need an efficient solution, as the text is set every time a new picture is selected (and users love to swish through them)...

Thanks and sunny greetings from Berne, Stephan Wiesner

4

1 回答 1

-1

您可以使用 HTML 格式的文本,例如

textView.setText(Html.fromHtml("<font color=#ffff00>" + My name + "</font>" +" " +"<font color=#ffffff>" + is + "</br> bull. "+ "</font>"));

字体颜色将改变文本的颜色并将文本移动到下一行。

不要忘记在您的 XML 中创建 textview 多行。希望这对您有所帮助。

于 2013-02-18T14:10:13.663 回答