本文介绍了有没有一种方法来隐藏在一个TextView文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法隐藏一些在一个TextView文本(但不是全部)?我试着大小设置为0与AbsoluteSizeSpan,但没有,我看不到任何的视觉效果。 (你可以设置大小为1,你基本上得到坎坷行,而不是可读文本,可爱的,但不完全是我后。)

通过隐藏,我的意思走,不可见,不占用空间。绘制文本具有相同的颜色作为背景是不是我要找的。

我知道我可以只用我想要显示的文本替换TextView的文字,但我已经使用跨度做了很多更加动感的造型,让人觉得一HiddenSpan将是有益的。它是否存在?

解决方案

我想你要找的: TextView.setVisibility(View.GONE)

Is there a way to hide some (but not all) of the text in a TextView? I tried setting the size to 0 with AbsoluteSizeSpan, but that doesn't have any visual effect that I see. (You can set the size to 1, and you essentially get bumpy lines instead of readable text. Cute, but not quite what I'm after.)

By hide, I mean go away, not be visible and not take up space. Drawing text with the same color as the background isn't what I'm looking for.

I realize I can just replace the text in the TextView with only the text I want to display, but I'm already using spans to do a lot more dynamic styling, and something like a HiddenSpan would be useful. Does it exist?

解决方案

I think you're looking for: TextView.setVisibility(View.GONE)

这篇关于有没有一种方法来隐藏在一个TextView文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 13:46