I want to have my text stroke out. I use a custom strike line image. So far I did this:
<RelativeLayout
android:id="@+id/title_container"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#FFFF0000">
<TextView
android:id="@+id/title"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:duplicateParentState="true"
android:singleLine="true"
android:ellipsize="end"
android:textColor="@color/title_text"
android:textSize="18dp"
android:background="#FF00FF00"
/>
<ImageView
android:id="@+id/title_strike_through"
android:contentDescription="@null"
android:layout_centerVertical="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:duplicateParentState="true"
android:src="@drawable/title_strike"/>
</RelativeLayout>
The problem now is that title_container layout stretches across whole width of the window, and as a result title_strike_through stretches too. It should not! I only need title_strike_through stretching over the text. What should I do?