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>
Seems like your
layout_weightfor views is not kicking-in. For that, I think you are missing to defineandroid:weightSum="10"within yourLinearLayoutdefinition. Moreover, you need to setandroid:layout_width="0dp"to both of yourTextView.