就是一个简单明了的东西,有时候真的就整不出来了,在找了半天还是不行。于是乎继续找,找到一个新帖子里说,版本更新了,老版本直接可用,老代码拿过来用不成了。
再于是乎,得修理一下子才行。
第一步,添加一个textview。
<TextView
android:id="@+id/viewid"
android:singleLine="true"
android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="一大推七七八八的文字,多写一点就是成就。"
android:textColor="@color/white"
android:scrollHorizontally="true"
android:focusable="true"
android:focusableInTouchMode="true"
/>
第二步,在activity 或 fragment 里。
TextView textView=findViewById(R.id.viewid);
textView.setSelected(true);
就是这一步让文字动起来!不要忘记。
记录于此!
送给有需要的朋友!