Android textview 走马灯效果无效问题
今天我学到Android textview 走马灯效果时,照着书敲了一遍,结果在模拟器上运行了一遍,结果并无卵用,百度查了很久,总算看明白一些,但是都没用,最后弄了好久,缺了一行,现展示如下:
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:singleLine="true"
android:text="快讯:红色预警,超强台风“莫兰蒂”即将登陆,请居民关紧门窗、备足粮草,做好防汛救灾准备!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="153dp" >//高版本的android这里控件是/>结尾改成>
<requestFocus/>//这就是不能显示的关键一句,其他基本和书上一样,这句一定要有
</TextView>