一直滚动的TextView[跑马灯效果]

朱雀 2022-01-16 01:31 406阅读 0赞

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

/**
* 一直滚动的TextView[跑马灯效果]
*/
public class AlwaysMarqueeTextView extends TextView {

public AlwaysMarqueeTextView(Context context) {
super(context);
}

public AlwaysMarqueeTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}

public AlwaysMarqueeTextView(Context context, AttributeSet attrs,
int defStyle) {
super(context, attrs, defStyle);
}

@Override
public boolean isFocused() {
return true;
}
}

  1. <com.xxx.view.AlwaysMarqueeTextView
  2. android:id="@+id/xxx\_tv01"
  3. android:layout\_width="fill\_parent"
  4. android:layout\_height="wrap\_content"
  5. android:layout\_alignParentLeft="true"
  6. android:layout\_centerInParent="true"
  7. android:ellipsize="marquee"
  8. android:focusable="true"
  9. android:marqueeRepeatLimit="marquee\_forever"
  10. android:singleLine="true"
  11. android:text="一直滚动的TextView\[跑马灯效果\]"
  12. android:textColor="@color/black" />

转载于:https://my.oschina.net/dminter/blog/205074

发表评论

表情:
评论列表 (有 0 条评论,406人围观)

还没有评论,来说两句吧...

相关阅读

    相关 使用TextView实现马灯效果

    初学安卓里的控件时 发现如果TextView 如果过于长的话后面的部分会自动转移到第二行 或者显示不完全 所以就研究了一下如果实现滚动效果 可以用在很多地方 比如歌词的显示