快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

Android开发中通过使用TextView实现一个字体滚动效果

这篇文章给大家介绍 Android开发中通过使用TextView实现一个字体滚动效果,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。

创新互联建站,为您提供成都网站建设重庆网站制作、网站营销推广、网站开发设计,对服务砂岩浮雕等多个行业拥有丰富的网站建设及推广经验。创新互联建站网站建设公司成立于2013年,提供专业网站制作报价服务,我们深知市场的竞争激烈,认真对待每位客户,为客户提供赏心悦目的作品。 与客户共同发展进步,是我们永远的责任!

Android TextView 字体滚动效果

实例代码:

package com.godinsec.seland.ui.tools; 
 
import android.content.Context; 
import android.text.TextUtils.TruncateAt; 
import android.util.AttributeSet; 
import android.widget.TextView; 
 
public class MarqueTextView extends TextView { 
 
  public MarqueTextView(Context context, AttributeSet attrs, int defStyle) { 
    super(context, attrs, defStyle); 
    init(context); 
  } 
 
  public MarqueTextView(Context context, AttributeSet attrs) { 
    super(context, attrs); 
    init(context); 
  } 
 
  public MarqueTextView(Context context) { 
    super(context); 
    init(context); 
  } 
 
  private void init(Context context) { 
     setEllipsize(TruncateAt.MARQUEE) ; 
  } 
 
  @Override 
  public boolean isFocused() { 
 
    return true; 
  } 
} 

Android  XML:

 

关于 Android开发中通过使用TextView实现一个字体滚动效果就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。


新闻标题:Android开发中通过使用TextView实现一个字体滚动效果
网站URL:http://6mz.cn/article/pdghds.html

其他资讯