[英]Android TextView set Marquee,How to remove the shadow at left and right of the TextView
I set the Marquee of TextView,and its running well,but when the text moving, there are shadows at left and right of the TextView,how to remove the shadows?我设置了TextView的Marquee,它运行良好,但是当文本移动时,TextView的左右两边都有阴影,如何去除阴影? my xml code
我的xml代码
<TextView
android:id="@+id/tv_result"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center_vertical"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="20sp" />
There are not shadows of the text,just like Masks align the left and right of the TextView.When marquee is running,they are displayed.And dismiss when marquee is stop.文本没有阴影,就像Masks对齐TextView的左右两边一样。当marquee运行时,它们被显示。并且当marquee停止时关闭。
extends the TextView overwrite onDraw()扩展 TextView 覆盖 onDraw()
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
setHorizontalFadingEdgeEnabled(false);
}
只需调用setFadingEdgeLength(0)
即可,无需扩展 TextView。
在你的文本视图上使用 setShadowLayer
tv_result.setShadowLayer(0,0,0,0)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.