Android Textview包装和难看的格式
我已经创建了一个android textview字段。我的问题是,只要行上有一个回车或“/n”,我就希望所有文本都出现在新行中。例如:- 我在下面有一行文字:-Android Textview包装和难看的格式,android,Android,我已经创建了一个android textview字段。我的问题是,只要行上有一个回车或“/n”,我就希望所有文本都出现在新行中。例如:- 我在下面有一行文字:- Twinkle, twinkle, little star,How I wonder what you are. Up above the world so high,Like a diamond in the sky. 我希望它如下图所示,但当我使用下面的代码时,它会在运行时包装行。你知道我该怎么做吗?下面是我的代码 <L
Twinkle, twinkle, little star,How I wonder what you are.
Up above the world so high,Like a diamond in the sky.
我希望它如下图所示,但当我使用下面的代码时,它会在运行时包装行。你知道我该怎么做吗?下面是我的代码
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".DisplayGanMessageActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/title_activity_display_gan_message" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/textView1"
android:layout_marginTop="18dp"
android:text="
Twinkle, twinkle, little star,How I wonder what you are.
Up above the world so high,Like a diamond in the sky."/>
我从中获得了以下输出:- 闪烁,闪烁,小星星,我多么想知道你是什么。在世界的上空如此之高,就像天空中的一颗钻石
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/textView1"
android:layout_marginTop="18dp"
android:text="Twinkle, twinkle, little star,How I wonder what you are. \n Up above the world so high,Like a diamond in the sky."/>
我从中获得以下输出:-闪烁,闪烁,小星星,我怎么想知道你是什么。在世界的上空如此之高,就像天空中的钻石。可能要将其更改为\n以用于新行