Reputation: 2669
I have a custom cell for my listview which has TEXT NUMBER - which works fine, however when the TEXT goes over one line, the right hand number goes over more than one line too which looks silly. Is there a property to fix this from happening?
My XML is:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/txtOption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="7"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/txtCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="3"
android:paddingBottom="5dp"
android:paddingLeft="25dp"
android:paddingRight="15dp"
android:paddingTop="5dp"
android:text="[21]"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
Upvotes: 2
Views: 1331
Reputation: 68177
Seems like your layout_weight
for views is not kicking-in. For that, I think you are missing to define android:weightSum="10"
within your LinearLayout
definition. Moreover, you need to set android:layout_width="0dp"
to both of your TextView
.
Upvotes: 1