it's easy to do via XML. Use the following settings:
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:focusable="false"
android:scrollHorizontally="true"
If your TextView is within a RelativeLayout, the width or height will have to be static (i.e. 32dp). If you need dynamic, place the TextView in another View within the RelativeLayout.
In onCreate(), you need to make the TextView selected:
myTextView.setSelected(true);
本文详细介绍了如何通过XML配置TextView的属性,包括单行显示、马赛克显示、滚动等特性。对于需要动态调整的TextView,提供了在RelativeLayout中放置另一View的方法。此外,演示了如何在onCreate()方法中使TextView选中。
364

被折叠的 条评论
为什么被折叠?



