Nikhil
Nikhil

Reputation: 2318

Is there a way to set the text in the text view to invisible?

I can't change its color or use alpha because the background may change and I won't know its color! Is there any other way to set it to invisible ? Also I don't want to set the text view invisible since I want the background to be visible!

Upvotes: 2

Views: 2985

Answers (4)

why not, set text value as empty string when you want to make it invisible. keep backup of the original value so that you can use it later when required.

Upvotes: 1

Vyacheslav Shylkin
Vyacheslav Shylkin

Reputation: 9791

Try:

textView.setTextColor(getResources().getColor(android.R.color.transparent));

Upvotes: 6

AndroidNoob
AndroidNoob

Reputation: 2821

You can set a textview to INVISIBLE:

myTextView.setVisibility(View.INVISIBLE);

That way the textview will still be present but not seen

Upvotes: 5

ngesh
ngesh

Reputation: 13501

Something like this..

String text = "Invisible Text";

TextView text1 = new TextView();
text1.setTag(text);

Upvotes: 1

Related Questions