Android: how to make two TextViews placed in different lines if there is no enough space in one line
- by bluebyte
I'am trying to organize two TextViews to behave like that:
So, if there is enough space for both TextViews in line, android should place them in line.
If there is no enough space, the second TextView must be placed on a next line with right alignment.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/takeoffCity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/flightItem" />
<TextView
android:id="@+id/landingCity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/flightItem" />
</LinearLayout>
<style name="flightItem" parent="@android:style/TextAppearance">
<item name="android:textSize">14dip</item>
<item name="android:textColor">@color/flightItemFont</item>
<item name="android:scrollHorizontally">true</item>
<item name="android:textStyle">bold</item>
</style>