Text View is an UI element that allows users to view and/or modify the displayed text. Use this tag for programming questions related text views, and add the relevant programming language or technology tag to get more exposure for your question. General UX questions regarding where to place a text view, and other similar opinion based questions are not on topic for Stack Overflow.
Questions tagged [textview]
14126 questions
2306
votes
74 answers
How do I center text horizontally and vertically in a TextView?
How do I center the text horizontally and vertically in a TextView, so that it appears exactly in the middle of the TextView in Android?

Pablo Fernandez
- 279,434
- 135
- 377
- 622
1150
votes
40 answers
How to make links in a TextView clickable
I have the following TextView defined:

Richard
- 28,691
- 8
- 33
- 34
984
votes
35 answers
Auto Scale TextView Text to Fit within Bounds
I'm looking for an optimal way to resize wrapping text in a TextView so that it will fit within its getHeight and getWidth bounds. I'm not simply looking for a way to wrap the text- I want to make sure it both wraps and is small enough to fit…

Nathan Fig
- 14,970
- 9
- 43
- 57
956
votes
28 answers
How to set TextView textStyle such as bold, italic
How to set TextView style (bold or italic) within Java and without using the XML layout?
In other words, I need to write android:textStyle with Java.

JustMe
- 10,033
- 5
- 20
- 12
906
votes
32 answers
Making TextView scrollable on Android
I am displaying text in a TextView that appears to be too long to fit
into one screen. I need to make my TextView scrollable. How can I do
that?
Here is the code:
final TextView tv = new…

Muhammad Maqsoodur Rehman
- 33,681
- 34
- 84
- 124
882
votes
29 answers
How to display HTML in TextView?
I have simple HTML:
Title
description here
I want to display HTML styled text it in TextView. How to do this?
UMAR-MOBITSOLUTIONS
- 77,236
- 95
- 209
- 278
831
votes
39 answers
How to change fontFamily of TextView in Android
So I'd like to change the android:fontFamily in Android but I don't see any pre-defined fonts in Android. How do I select one of the pre-defined ones? I don't really need to define my own TypeFace but all I need is something different from what it…

Tarik
- 79,711
- 83
- 236
- 349
816
votes
23 answers
How to put a border around an Android TextView?
Is it possible to draw a border around an Android TextView?

yamspog
- 18,173
- 17
- 63
- 95
719
votes
19 answers
How to make a background 20% transparent on Android
How do I make the background of a Textview about 20% transparent (not fully transparent), where there is a color in the background (i.e. white)?

Adham
- 63,550
- 98
- 229
- 344
611
votes
40 answers
How to set the text color of TextView in code?
In XML, we can set a text color by the textColor attribute, like android:textColor="#FF0000". But how do I change it by coding?
I tried something like:
holder.text.setTextColor(R.color.Red);
Where holder is just a class and text is of type…

Vikas
- 24,082
- 37
- 117
- 159
607
votes
30 answers
How to hide underbar in EditText
How can I hide the EditText underbar (the prompt line with little serifs at the ends)?
There might be a better way to do what I want: I have a layout with an EditText. Normally, this displays fine where the user can tap on it and begin entering or…

Peri Hartman
- 19,314
- 18
- 55
- 101
577
votes
20 answers
Is it possible to have multiple styles inside a TextView?
Is it possible to set multiple styles for different pieces of text inside a TextView?
For instance, I am setting the text as follows:
tv.setText(line1 + "\n" + line2 + "\n" + word1 + "\t" + word2 + "\t" + word3);
Is it possible to have a different…

Legend
- 113,822
- 119
- 272
- 400
530
votes
33 answers
Android - Handle "Enter" in an EditText
I am wondering if there is a way to handle the user pressing Enter while typing in an EditText, something like the onSubmit HTML event.
Also wondering if there is a way to manipulate the virtual keyboard in such a way that the "Done" button is…

Felix
- 88,392
- 43
- 149
- 167
527
votes
12 answers
How to set the font style to bold, italic and underlined in an Android TextView?
I want to make a TextView's content bold, italic and underlined. I tried the following code and it works, but doesn't underline.

d-man
- 57,473
- 85
- 212
- 296
509
votes
22 answers
How do you change text to bold in Android?
How do you change text/font settings in an Android TextView?
For example, how do you make the text bold?

nithin
- 5,091
- 2
- 15
- 3