Questions tagged [textview]

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.

14126 questions
178
votes
13 answers

Different font size of strings in the same TextView

I have a textView inside with a number (variable) and a string, how can I give the number one size larger than the string? the code: TextView size = (TextView)convertView.findViewById(R.id.privarea_list_size); if (ls.numProducts != null) { …
Ortensia C.
  • 4,666
  • 11
  • 43
  • 70
177
votes
23 answers

android ellipsize multiline textview

I need to ellipsize a multi-line textview. My component is large enough to display at least 4 lines with the ellipse, but only 2 lines are displayed. I tried to change the minimum and maximum number of rows of the component but it changes nothing.
Arutha
  • 26,088
  • 26
  • 67
  • 80
175
votes
21 answers

Multiline TextView in Android?

I did like below in xml
Chatar Veer Suthar
  • 15,541
  • 26
  • 90
  • 154
174
votes
16 answers

How to set a ripple effect on textview or imageview on Android?

I want to set a ripple effect on textview and imageview in Android Studio. How can I do it?
Vasant
  • 3,475
  • 3
  • 19
  • 33
174
votes
3 answers

dpi value of default "large", "medium" and "small" text views android

Does the documentation ( or anyone) talks about the dpi values of the default Large TextView {android:textAppearance="?android:attr/textAppearanceLarge"} Medium TextView {android:textAppearance="?android:attr/textAppearanceMedium"} Small TextView …
Vinay W
  • 9,912
  • 8
  • 41
  • 47
173
votes
10 answers

How to draw rounded rectangle in Android UI?

I need to draw a rounded rectangle in the Android UI. Having the same rounded rectangle for TextView and EditText would also be helpful.
M.A.Murali
  • 9,988
  • 36
  • 105
  • 182
170
votes
19 answers

How to bring view in front of everything?

I have activity and a lot of widgets on it, some of them have animations and because of the animations some of the widgets are moving (translating) one over another. For example the text view is moving over some buttons . . . Now the thing is I want…
Lukap
  • 31,523
  • 64
  • 157
  • 244
167
votes
13 answers

Kotlin addTextChangeListener lambda?

How do you build a lambda expression for the EditText addTextChangeListener in Kotlin? Below gives an error: passwordEditText.addTextChangedListener { charSequence -> try { password = charSequence.toString() } catch (error:…
LEMUEL ADANE
  • 8,336
  • 16
  • 58
  • 72
162
votes
21 answers

Is there an easy way to strike through text in an app widget?

I was wondering if there is an easy way to strike text within an app widget in Android. In a normal activity, it is pretty easy, using textview flags: textView.setPaintFlags(textView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); But since in an…
Antonio
  • 3,128
  • 2
  • 22
  • 14
161
votes
20 answers

TextView Marquee not working

I have tried to use marquee and its not working here is my code, please let me know where im going wrong
amithgc
  • 6,167
  • 6
  • 29
  • 38
159
votes
8 answers

How to change letter spacing in a Textview?

How can i change letter spacing in a textview? Will it help if I have HTML text in it (I cannot use webview in my code). P.S. I'm using my own typeface in the textview with HTML text.
OkyDokyman
  • 3,786
  • 7
  • 38
  • 50
154
votes
14 answers

Android TextView with Clickable Links: how to capture clicks?

I have a TextView which is rendering basic HTML, containing 2+ links. I need to capture clicks on the links and open the links -- in my own internal WebView (not in the default browser.) The most common method to handle link rendering seems to be…
Zane Claes
  • 14,732
  • 15
  • 74
  • 131
154
votes
11 answers

How do I enable standard copy paste for a TextView in Android?

I want to enable standard copy paste for a TextView (the same as for EditText). How can I do it? I tried using a non-editable EditText but it didn't work well (sometimes it became editable or the copy paste overlay was not shown). And it's probably…
User
  • 31,811
  • 40
  • 131
  • 232
152
votes
13 answers

handle textview link click in my android app

I'm currently rendering HTML input in a TextView like so: tv.setText(Html.fromHtml("test")); The HTML being displayed is provided to me via an external resource, so I cannot change things around as I will, but I can, of course,…
David Hedlund
  • 128,221
  • 31
  • 203
  • 222
149
votes
4 answers

Android: TextView automatically truncate and replace last 3 char of String

If a String is longer than the TextView's width it automatically wraps onto the next line. I can avoid this by using android:singleLine (deprecated) or by setting android:inputType="text". What I need now is something that replaces the last 3…
znq
  • 44,613
  • 41
  • 116
  • 144