Android: LinearLayout (horizontal) cuts off last column -
very simple layout: have 2 textviews displayed in single line. layout centered on screen , 2 strings set programmatically, first vairaible length string while second string either empty or (let's say) "x":
<linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginbottom="5dp" android:gravity="center_horizontal" android:orientation="horizontal" > <textview android:id="@+id/lblselectionname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" android:singleline="true" android:text="@string/empty" android:textappearance="?android:attr/textappearancemedium" /> <textview android:id="@+id/lblselectionattribute" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/empty" android:textappearance="?android:attr/textappearancemedium" /> </linearlayout>
please note, first textview ellipsized in order cut off string if size exceeds textview. expect like:
"normal text | x" (centered on screen)
"extralarge text must be... | x" (centered on screen - filling screen)
but happens is: first textview elipsizes fills whole screen(-width) , second textview off screen (wrapped next line respectively). using "weight" not anyway. setting layout_height fixed value (e.g. 15dp) doesn't too...
any advice anyone?
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginbottom="5dp" android:orientation="horizontal" android:layout_gravity="center_horizontal" > <textview android:id="@+id/lblselectionname" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:ellipsize="end" android:singleline="true" android:text="asdhsagdkgfhgfhghg" android:textappearance="?android:attr/textappearancemedium" /> <textview android:id="@+id/lblselectionattribute" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="x" android:textappearance="?android:attr/textappearancemedium" /> </linearlayout>
Comments
Post a Comment