java - Center a block of two Views in Android -


I want a block of two labels to focus horizontally in the screen, I currently have the following code: Android: layout_gravity = "center" android: orientation = "horizontal" & gt; & Lt; TextView android: id = "@ + id / TextView02" Android: Layout_width = "Wrap_content" Android: Layout_height = "Wrap_content" Android: Ellipsaij = "end" Android: singleLine = "true" android: text = "Lorem Ipsum" Android: Textcolor = "# FF0000" /> & Lt; TextView android: id = "@ + id / TextView01" Android: Layout_width = "Wrap_content" Android: Layout_height = "Wrap_content" Android: singleLine = "true" android: text = "Test 2" Android: textcolor = "# 00ff00" / & Gt; & Lt; / LinearLayout & gt;

This is fine when text is small (see image below):

 Enter the image details here

But when the red text is long (or the screen is narrow) green text is unavailable:

 Enter image details here

Since green text is a word, I want it to be a priority, always visible If needed, red colored waves (and keep the block centered)

How should it look like this:

Enter image details here < / P>

How can I get it?

Note: I have to use two textviews as they should be animated

try here:

  Android: Line_Lyout Android: Layout_width = "Match_parent" Android: Layout_height = "Wrap_content" Android: layout_gravity = "center" android: orientation = "horizontal" & gt; & Lt; TextView android: id = "@ + id / TextView02" Android: layout_width = "0dp" Android: Layout_height = "Wrap_content" Android: layout_weight = "1" Android: Ellipsaij = "end" android: gravity = "right" Android: SingleLine = "true" android: text = "Android: Android: text collar =" # FF 0000 "/ & gt; & LT; TextView android: id =" @ + id / TextView01 "Android: Layout_width =" Wrap_content "Android: layout_height = "Wrap_content" Android: gravity = "left" Android: singleLine = "true" Android: text = "TextView" Android: TextCall = "# 00ff00" / & gt; & lt; / Linarlyut & gt;    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -