Android TextView跑马灯不动

xiaoxiao2021-02-28  125

<TextView android:text="每一个视图的绘制过程都必须经历三个最主要的阶段,即onMeasure()、onLayout()和onDraw()," android:layout_width="60dp" android:layout_height="wrap_content" android:ellipsize="marquee" android:focusable="true" android:focusableInTouchMode="true" android:marqueeRepeatLimit="marquee_forever" android:scrollHorizontally="true" android:singleLine="true" />

第一.6个属性必须要设置

android:ellipsize="marquee"//文字显示不完全,以什么方式显示(这里就以滚动的行形式) android:focusable="true"//获得焦点 android:focusableInTouchMode="true"//获得触摸焦点 android:marqueeRepeatLimit="marquee_forever"//滚动模式 android:scrollHorizontally="true"//横向滚动 android:singleLine="true"//以单行文本显示

第二,显示的文字必须要超出给定的宽度

另外说明一点

android:singleLine="true"提示过时了,但是换成maxLines=“1”,效果就没了。。。

另外推荐一篇文章:https://blog.csdn.net/iblade/article/details/83419738

转载请注明原文地址: https://www.6miu.com/read-28066.html

最新回复(0)