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>