Reputation: 658
So I've got a text view with a maxWidth attribute set on it.
<com.workday.workdroidapp.sharedwidgets.KingfisherTextView
android:id="@+id/contact_item_title"
android:layout_width="wrap_content"
android:maxWidth="@dimen/contact_cell_title_max_width"
android:layout_height="wrap_content"
style="@style/Title.Dark"
android:maxLines="1"
android:ellipsize="end"
tools:text="Title" />
Say that I want to remove that maxWidth programatically because the text view which would normally make me want to constrain it is empty. How can I do that? The only method I seem to have access to is setMaxWidth, with no special value to remove the flag.
Upvotes: 3
Views: 1762
Reputation: 3165
Simply call myTextView.setMaxWidth(Integer.MAX_VALUE)
. That is actually what TextView does internally:
private int mMaxWidth = Integer.MAX_VALUE;
Upvotes: 5