views:

39

answers:

2

Hi, I'm trying to make my horizontal layouts take advantage of the room available.

In an info showing activity I have a 'fact box' followed by a large box of text. I'd like the infobox to float right, similar to the following picture.

Is this possible using the android TextView api?

Example picture

+1  A: 

I fear this is not possible with a single TextView. A TextView has to be an rectangle and is not able to display child views. A workaround could be to create two TextViews and make the first one cut of the text, then ask the first textview how much it can display and add the rest of the string to the second text view.

Janusz
I couldn't find a method to check how much text can be displayed in a TextView. Maybe there is a way to do this but I couldn't find it now.
Janusz
I know about the Paint.breaktext method. If I could get the Paint from the TextView, that could be doable.
Thomas Ahle
+1  A: 

I would suggest employing a WebView for this. You can format the text in a web view with the usual HTML / CSS formatting, with which your desired layout is pretty simple to accomplish.

Thorstenvv
Right, but it would be rather messy to share resources and stuff?
Thomas Ahle