I have a ListView cell with a TextView and an ImageView. I would like the ImageView to stay on the right side and the TextView width to be "the cell width minus all space taken up by the ImageView". Right now I am using this:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="@dimen/defaultCellHeight">
<TextView
android:id="@+id/randomSettingShow"
android:layout_width="wrap_content"
android:layout_height="@dimen/defaultCellHeight"
android:paddingLeft="30dp"
android:textSize="@dimen/defaultTextSize"
android:focusable="false"
android:textStyle="normal"
android:gravity="center_vertical|left"
android:layout_alignParentLeft="true" />
<ImageView
android:id="@+id/randomSettingShowCheck"
android:layout_width="wrap_content"
android:layout_height="@dimen/defaultCellHeight"
android:gravity="center"
android:layout_marginRight="15dp"
android:layout_alignParentRight="true"
android:contentDescription="@string/checkmark" />
</RelativeLayout>
But the problem is that if the text in the TextView is long enough, the text goes under the ImageView and obviously, this is incorrect. I would like the TextView to have a max width set to the left border of the ImageView.
How can I do that?