在文本视图的末尾显示三个点

Pra*_*mar 4 android textview

在右侧,我使用 textview 来显示选定的时区,如果用户选择它,则警报对话框将根据选择打开我正在显示值.. 现在的问题是我的时区值太长然后它不会显示如下图像..我必须用“ ... ”替换它,如果它超过..如果我设置最大长度,它将适用于这个小设备..但文本视图大小将根据设备宽度而改变。所以我有点困惑如何处理这个..你能帮我解决这个问题吗?

<LinearLayout
    android:layout_width="match_parent"
    android:minHeight=“60dp”
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_marginBottom=“10dp”
    android:visibility="visible">

  <EditText
     android:id="@+id/etZipCode"
     android:padding=“15dp”
     android:layout_marginBottom=“10dp”
     android:singleLine=true
     android:layout_width="match_parent"
     android:layout_weight="1"
     android:layout_height="wrap_content"
     android:maxLength=“8“
     android:inputType="text"
     android:imeOptions="actionNext" />

    <TextView
     android:padding=“15dp”
     android:layout_marginBottom=“10dp”
     android:singleLine=true
     android:layout_width="match_parent"
     android:minHeight="50dp"
     android:layout_height="wrap_content"
     android:layout_weight="1"
     android:drawableRight="@drawable/ic_dropdown_pin"
     android:layout_marginBottom=“10dp“
     android:layout_marginLeft=“5dp”/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

K N*_*Lal 9

drawablePaddingmaxLines和一起添加属性ellipsize

尝试这个,

    <EditText
        android:id="@+id/etZipCode"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:layout_weight="1"
        android:imeOptions="actionNext"
        android:inputType="text"
        android:maxLength="8"
        android:text="3445"
        android:padding="15dp"
        android:singleLine="true"/>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:layout_marginLeft="5dp"
        android:layout_weight="1"
        android:drawableRight="@drawable/ic_dropdown_pin"
        android:minHeight="50dp"
        android:padding="15dp"
        android:text="Alaska Standard Time"
        android:ellipsize="end"
        android:maxLines="1"
        android:drawablePadding="10dp"
        android:singleLine="true"/>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

截图如下,

截屏