如何更换淡入/淡出边椭圆形在Android SDK中的TextView? [英] How to replace ellipses with fade / fading edge in textview in Android sdk?

查看:266
本文介绍了如何更换淡入/淡出边椭圆形在Android SDK中的TextView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列表,列表中的每一行都有文字。一些文字超出屏幕的边缘。我没有问题,使得它截断文本,并显示椭圆。我没有问题为'淡出文本的边缘然而,淡变发生在每个文本的边缘,而不是仅在是用于TextView的太大。我已经搜查,搜查,并不能找到一个办法,从本质上讲,做的究竟的什么省略号做,但而不是椭圆,褪色的文字边缘的只有的若它是将在屏幕的边缘。任何人都可以请帮助?仅供参考,现在,我的文字视图包含:

I have a list, each row in the list has text. Some of the text extends beyond the edge of the screen. I have no problem making it truncate the text and show ellipses. I have no problem to 'fade the edge of the text' however, the fade occurs at the edge of every text, not just the ones the are too large for the textview. I have searched and searched and can't find a way to, essentially, do exactly what the ellipses do but, instead of ellipses, fade the edge of the text only if it is going off the edge of the screen. Can anyone please help? FYI, right now, my text view contains:

android:fadingEdge="horizontal" 
android:inputType="text"
android:maxLines="1"

但是,很明显,我已经尝试了许多其他的东西没有用...:_(

but, obviously, I have tried many other things to no avail... :_(

推荐答案

要启用字幕和simulateouly不影响列表中选择只需使用下列内容:

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

在code只使用在该文本视图的两种方法。

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

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

这篇关于如何更换淡入/淡出边椭圆形在Android SDK中的TextView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆