开发者

Android fuzzy / faded fonts possible?

So I am developing a very simple app, mostly for personal use, am am looking for a simple solution to a simple problem.

In its simplest form I am looking for a way to have a line of text with just one or two words blurred out. Basically I am looking to blur text beyond readability but still hinting at what is hidden. Kind of a knowledge / memory app to help memorize some definitions by prompting with a few key words.

I am having issues finding a simple way to accomplish this. Am I just missing an attribute to blur text?

I have thought about:

  • overriding say the textview onDraw but that seems overkill and I am unsure if there are any methods available to easily blur text.

  • using the toHtml and trying out the new CSS3 blur effects but I don't think that that is a reasonable solution and I am not sure that the Android platform supports all the CSS3 format, if any.

  • the simplest and most desirable solution in my book was to find a font (ttf, off, etc) file, derived from a common font, that is already blurred as I described, and use that alternating with the non blurred version of that font to achieve the desired effect.

  • make the described font but that just plain requires too much time on my p开发者_如何学Goart and the outcome is not necessarily good :)

I have thought about some alternative ways to simulate this effect but they all result in fading the text, which is undesirable, since I want to have some visual prompts to indicate the obscured texts length.

Any ideas? It's been years since I have developed in Java and I am unsure what is available and what the Android OS supports.


I haven't looked into using these properties for only part of the text, but TextView has some possibly useful properties related to text shadows. Using something like the following XML attributes, you could hide the actual text and just show a blurred shadow.

android:textColor - #0000 (fully transparent so that the crisp text is not shown)

android:shadowColor - #FFFF (or whatever color you want to appear)

android:shadowDx - 0 (the shadow is in the same horizontal position as the text)

android:shadowDy - 0 (the shadow is in the same vertical position as the text)

android:shadowRadius - Depends on how much you want to blur. A very small non-zero value, such as 0.001, will be sharp. Larger values blur more, and at some point the shadow becomes illegible.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜