I have a button and a listView. When user selects any item in list, i should update the button text with the item name and X at the end. When user clicks on the updated button, i am updating the list and change the button text to the default text. I am trying to achieve this by adding android:ellipsize="middle" to the button xml but it is not working. Ref: What does ellipsize mean in android?
<Button
android:id="@+id/actor_selected"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/thetake_orange"
android:textColor="@color/white_color"
android:layout_toRightOf="@id/seperator"
android:layout_margin="5dp"
android:paddingLeft="2dip"
android:paddingRight="2dip"
/>
SOLUTION I got this working.
<Button
android:id="@+id/actor_selected"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/thetake_orange"
android:textColor="@color/white_color"
android:drawableRight="@drawable/abc_ic_clear_mtrl_alpha"
android:layout_toRightOf="@id/seperator"
android:layout_margin="5dp"
android:paddingLeft="2dip"
android:paddingRight="2dip"
android:singleLine="true"
android:ellipsize="middle"
/>