在短 TextView 中显示长文本?
Show long text in short TextView?
如何创建一个长文本的TextView,让这个TextView中的文本像横滑一样自动从头到尾查看和显示?
其实我是想让textview自动滚动,文字结束后从头开始重新滚动
图像是我的代码的输出,但我不想要这个。
enter image description here
在 textView
内制作 ellipsize=marquee
和 singleLine=true
我找到答案了!
您必须将这些功能添加到 TextView 中:
android:ellipsize = "marquee"
android:fadingEdge = "horizontal"
android:marqueeRepeatLimit = "marquee_forever"
android:scrollHorizontally = "true"
android:singleLine = "true"
然后:
TextView txt = findViewById(R.id.text);
txt.setSelected(真);
如何创建一个长文本的TextView,让这个TextView中的文本像横滑一样自动从头到尾查看和显示?
其实我是想让textview自动滚动,文字结束后从头开始重新滚动
图像是我的代码的输出,但我不想要这个。
enter image description here
在 textView
ellipsize=marquee
和 singleLine=true
我找到答案了!
您必须将这些功能添加到 TextView 中:
android:ellipsize = "marquee"
android:fadingEdge = "horizontal"
android:marqueeRepeatLimit = "marquee_forever"
android:scrollHorizontally = "true"
android:singleLine = "true"
然后:
TextView txt = findViewById(R.id.text); txt.setSelected(真);