Android: 从文本视图中删除最大宽度属性

Android: Remove max width attribute from Text View

所以我有一个设置了 maxWidth 属性的文本视图。

<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" />

说我想以编程方式删除 maxWidth,因为通常会让我想要限制它的文本视图是空的。我怎样才能做到这一点?我似乎可以访问的唯一方法是 setMaxWidth,没有用于删除标志的特殊值。

只需调用myTextView.setMaxWidth(Integer.MAX_VALUE)。这实际上是 TextView 内部所做的:

private int mMaxWidth = Integer.MAX_VALUE;

https://android.googlesource.com/platform/frameworks/base/+/jb-mr0-release/core/java/android/widget/TextView.java