所以我有一个里面有TextView
的ScrollView
。当文本的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>
发布于 2020-04-21 14:49:53
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:scrollbars="vertical">
<HorizontalScrollView
android:layout_width="match_parent" android:layout_height="wrap_content">
<FrameLayout android:layout_width="320dp"
android:layout_height="match_parent"
android:background="#000000"/>
</HorizontalScrollView>
</ScrollView>
发布于 2020-04-21 13:52:48
试试这个:
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="80dp"
android:layout_height="wrap_content"
android:scrollHorizontally="true"
android:text="Horizontal scroll text view"/>
</HorizontalScrollView>
https://stackoverflow.com/questions/61336734
复制相似问题