Saturday, 18 October 2014

Android TextView weights



I have an issue where I want the left subtext TextView (in grey) to take priority weight in the LinearLayout over the TextView on the right (in yellow). The TextView on the right always seems to take priority, while the one on the left wrapped. Any help is appreciated.


TextView weights issue


the XML for the layout is like this:



<LinearLayout
android:id="@+id/LinearLayout03"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-4dip" >

<TextView
android:id="@+id/TextView_nowplaying"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="3"
android:singleLine="true"
android:textColor="#ddd"
android:textSize="13dip" >
</TextView>

<TextView
android:id="@+id/TextView_listeners"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="#aaa"
android:textSize="13dip" >
</TextView>

<TextView
android:id="@+id/TextView_bitrate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="4dip"
android:singleLine="true"
android:textColor="#aaa"
android:textSize="13dip" >
</TextView>
</LinearLayout>

No comments:

Post a Comment