How to replace ellipses with fade / fading edge in textview in Android sdk?

好久不见. 提交于 2019-12-04 09:15:01
Arpit Garg

To enable marquee and simulateouly not affecting the list Selections Just use following:

In the code just use two methods on that text View.

textViewObj.setSelected(true);
textViewObj.setEllipsize(TextUtils.TruncateAt.MARQUEE);

The specific method call to enable the horizontal edge fade (on the right-hand side) is

setHorizontalFadingEdgeEnabled(true)

Here is an example from the constructor in my class ScrollTextView, which extends TextView:

public ScrollTextView(Context context, AttributeSet attrs) {
    this(context, attrs, android.R.attr.textViewStyle);
    setHorizontalFadingEdgeEnabled(true);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!