我有一個文本視圖,其中包含一段信息。我想讓文字不是通過字符來包裝。目前,如果這個詞很長,它會在詞的中間插入一個連字符並打破。在android中用文字換行TextView
這是我TextView的XML代碼
<ScrollView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_above="@+id/title"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="13dp"
android:id="@+id/scrollView2">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="130dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:ellipsize="start"
android:text="TextView"
android:textColor="#000000"
android:textSize="16sp"
android:visibility="visible" />
</LinearLayout>
</ScrollView>
感謝您的幫助。
您的代碼Android Studio中正常工作。你使用的是什麼android版本? – Darush
這可能有所幫助:https://stackoverflow.com/questions/4851659/how-to-wrap-text-in-textview-in-android – Darush