Android: EditText not getting ellipsis

I have 2 EditTexts in a linear layout and they don't get an ellipsis

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#696969" android:layout_marginBottom ="5px"> <EditText android:id="@+id/addressbar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft ="2px" android:layout_marginRight ="1.5px" android:layout_weight="0.35" android:textSize = "15sp" android:singleLine="true" android:editable = "true" android:textAppearance="?android:attr/textAppearanceMedium" android:ellipsize="end" android:imeOptions="actionGo" /> <EditText android:id="@+id/googlebar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft ="1.5px" android:layout_marginRight ="3px" android:background="@android:drawable/editbox_background" android:layout_weight="0.65" android:hint="Google" android:textSize = "15sp" android:singleLine="true" android:ellipsize="end" android:imeOptions="actionSearch" /> </LinearLayout> 

what do you think?

+4
source share
3 answers

Set this property to edit text. Elipsize works with disabled edit text

 android:lines="1" android:scrollHorizontally="true" android:ellipsize="end" android:singleLine="true" android:editable="false" 

or setKeyListener (zero); This job is great for me on all Android platforms.

+6
source

Ellipse is broken: Ellipse does not work for textView inside a customView list

Bug Report: http://code.google.com/p/android/issues/detail?id=882

I had to do the following to get started ... played a little

 android:lines="1" android:scrollHorizontally="true" android:ellipsize="end" 
+2
source

I have a solution, add this line to your android EditText: editable = false The Edittext will be elliptical, but this property is deprecated, but the event is not deprecated when this edittext is not suitable. I don't know how to make it editable again using java coding.

0
source

Source: https://habr.com/ru/post/1342368/


All Articles