textview

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

How do I center text horizontally and vertical in a TextView in Android? So that it appears exactly in the middle of the screen. ...

GTK: Resizing widgets contained in a textview

I have a Gtk.TextView control, and I'm inserting child widgets into it. I'd like to be able to have the children resize to fit the width of the TextView when the form is resized. Is there a built-in way to do this? If not, can anyone suggest a good way of writing my own? ...

Android TextView Timer

For my Android application there is a timer that measures how much time has passed. Ever 100 milliseconds I update my TextView with some text like "Score: 10 Time: 100.10 seconds". But, I find the TextView only updates the first few times. The application is still very responsive, but the label will not update. I tried to call .invalidat...

UITextView on a UIAlertView (multi-line input)

Hi, i'm having a couple of problems when i try to alloc a UITextView on an AlertView. Here is my code: UIAlertView* minhaCritica = [UIAlertView new]; minhaCritica.title = @"7Arte"; [minhaCritica addButtonWithTitle:@"Cancelar"]; [minhaCritica addButtonWithTitle:@"Enviar"]; minhaCritica.message = @"Escreve a tua crítica:\n\n\n\n"; minhaCr...

Syntax Highlighting in Cocoa TextView? Experiences? Suggestions? Ideas?

I'm interested in syntax highlighting in a Cocoa TextView. I found several resources: approach with flex, via a flex pattern matched against textStorageDidProcessEditing in a TextView delegate. In this approach the whole string get parsed on each input event, hence performance degrades. CocoaDev has an own page on the topic of syntax ...

How to access original activity's views from spawned background service

I have an activity called A, and on the selection of menu item 0, it spawns service B, which starts a runnable C in a new thread. I have a TextView in activity A, which I want to access in thread C. I've tried making the TextView a public static field, but that generates the following error: 07-21 07:26:25.723: ERROR/AndroidRuntime(...

Vertical (rotated) label in Android

I need 2 ways of showing vertical label in Android: Horizontal label turned 90 degrees counterclockwise (letters on the side) Horizontal label with letters one under the other (like a store sign) Do I need to develop custom widgets for both cases (one case), can I make TextView to render that way, and what would be a good way to do ...

Android TextView Justify Text

Hey, How do you get the text of a TextView to be Justified (with text flush on the left- and right- hand sides)? I found a possible solution here, but it does not work (even if you change vertical-center to center_vertical, etc). Cheers, Pete ...

Ellipsize not working for textView inside custom listView

Hi, I have a listView with custom objects defined by the xml-layout below. I want the textView with id "info" to be ellipsized on a single line, and I've tried using the attributes android:singleLine="true" android:ellipsize="end" without success. If I set the layout_width to a fixed width like e.g. android:layout_width="100px" ...

android TextView: setting the background color dynamically doesn't work

Setting the background color programatically of an android TextView doesn't seem to work. I'm I missing something! TextView et = new TextView(activity); et.setText("350"); et.setBackgroundColor(R.color.white); I also have this file (colors.xml) in my res/values folder <resources> <color name="white">#ffffffff</color> ...

How to put TextView in same position in landscape and portrait mode in Android

Hi All, I am facing a problem when i put a textview on screen in landscape mode it position is fine but when i switch to portrait mode it position is remain fix it not change according to screen resolution. please help me here ...

Android: 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: descbox.setText(line1 + "\n" + line2 + "\n" + word1 + "\t" + word2 + "\t" + word3); Now, is it possible to have a different style for each text element? I mean bold for line1, normal fo...

How to adjust text kerning in Android TextView?

Is there a way to adjust the spacing between characters in an Android TextView? I believe this is typically called "kerning". I'm aware of the android:textScaleX attribute, but that compresses the characters along with the spacing. ...

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 dif...

For Android: Changing view backgrounds,texts on Scroll Event

I have 27 drawables in my res folder. I want my TextView to have its background and text changed while the user scrolls vertically(both up and down).And i want this feature to carry on forever until and unless the user terminates the app manually. What scroll event i will use here in Android? Can somebody give me a code example please? ...

handle textview link click in my android app

I'm currently rendering HTML input in a TextView like so: tv.setText(Html.fromHtml("<a href='test'>test</a>")); 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, do some regex tampering with the HTML, to change the href value, say, to something else. ...

Is There A Standard Way To Allow The User To Select A Text Viewer?

In my Windows desktop program, I want to be able to allow the user to select a text viewer that my program will use. By default, I'll have it set to be the program (s)he uses to view .TXT files, and I can find that easily enough from the Registry. But he may want to change to use Notepad or Wordpad or some other program (e.g. UltraEdit)...

Android TextView's subscript being cliped off

The Android TextView clips off my text subscripts (see image below) even when I use android:layout_height="wrap_content" for the TextView. Is there a fix/work-around for this? P/S: Superscripts work fine Note: padding doesn't work. I tried even adding a padding of 50dip but it did not help. I can use an absolute height such as 50d...

Making TextView Scrollable in 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 TextView(this); tv.setBackgroundResource(R.drawable.splash); tv.setTypeface(face); tv.setTextSize(18); tv.setTextColor(R.color.BROWN); ...

Is there a way to make ellipsize="marquee" always scroll?

I want to use the marquee effect on a TextView, but the text is only being scrolled when the TextView gets focus. That's a problem, because in my case, it can't. I am using: android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" Is there a way to have the TextView always scroll its text? I've seen this being don...