Showing posts with label textview. Show all posts
Showing posts with label textview. Show all posts

Wednesday, May 30, 2012

Is it possible to have multiple styles inside a TextView?


I was wondering if its possible to set multiple styles for different pieces of text inside a TextView. For instance, I am setting the text as follows:

How do I center text horizontally and vertical in a TextView in Android?


How do I center the text horizontally and vertically in a TextView in android, so that it appears exactly in the middle of the screen?

Friday, May 18, 2012

How to click or tap on a TextView text


I know this is so easy (doh...) but I am looking for a way to run a method on tapping or clicking a TextView line of text in an Android App.

Wednesday, May 9, 2012

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 now need is something that replaces the last 3 characters of my String with " ... ". Since I'm not using a monospace font this will always be different depending on the letters used in my String. So I'm wondering what's the best way to get the last 3 characters of a String in a TextView and replace them. Maybe there's already something implemented in the Android framework, since this must me a common problem.

Tuesday, May 8, 2012

TextView setScaleX()/setScaleY() and setTextIsSelectable(true) selection


I have TextView and want to use setScaleX()/setScaleY() to make the text zoomable. But when I try to select some text by calling someTextView.setTextIsSelectable(true); and TextView has zoom other than 1.0f the text selection markers apprear in wrong place, it seems that the selection is shown in the old place of selected text.

Tuesday, April 3, 2012

Is it possible to have multiple styles inside a TextView?


I was wondering if its possible to set multiple styles for different pieces of text inside a TextView. For instance, I am setting the text as follows:

Highlighting Text Color using Html.fromHtml() in Android?


I am developing an application in which there will be a search screen where user can search for specific keywords and that keyword should be highlighted. I have found Html.fromHtml method.

Android textview outline text


Is there a simple way to have text be able to have a black outline? I have textviews that will be different colors, but some of the colors don't show up on my background so well, so I was wondering if there's an easy way to get a black outline or something else that will do the job? I'd prefer not to have to create a custom view and make a canvas and such.