【发布时间】:2020-04-21 05:47:24
【问题描述】:
所以我有一个ScrollView,里面有一个TextView。当文本的String 长于屏幕宽度时,它只是移动到下一行。我想通过在ScrollView 中添加HorizontalScrolling 来避免新衬里。另外,我想让文本可选择,以便用户可以复制文本。有可能吗?
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<TextView
android:id="@+id/text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="15dp"
android:ellipsize="end"
android:textIsSelectable="true"
android:justificationMode="inter_word"
android:lineSpacingExtra="5dp"
android:textSize="15sp"
tools:targetApi="o" />
</ScrollView>
【问题讨论】:
-
ScrollView 应该是水平和垂直的。
-
有一个叫
orientation的属性设置为horizontal你会确认它是否适合你 -
@hiwajalal 谢谢,我想通了。这很有帮助。
标签: java android textview scrollview