android - Set AutocompleteTextView hint in a single line with Ellipsize end -
i want set hint of autocompletetextview in single line string truncated dots(...) in end.
i using singleline="true"
, maxlines="1"
, ellipsize="end"
.
but still hint shown in 2 lines. although text set single line. need hint should need shown in single line. preview in android studio shows hint in single line. when run on device shows in 2 lines.(s5, nexus-5, nexus-6, j7).
i want imeoption should search. i.e. imeoptions="actionsearch"
hence can't change actionnext.
below xml code:
<relativelayout android:id="@+id/lilaysearchmap" android:layout_width="match_parent" android:layout_height="wrap_content" android:visibility="gone" android:paddingleft="10dp" android:background="@color/cococo" android:paddingright="10dp"> <autocompletetextview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="@dimen/five_dp" android:background="@color/white" android:padding="@dimen/two_dp" android:scrollhorizontally="true" android:drawablepadding="@dimen/two_dp" android:singleline="true" android:lines="1" android:maxlines="1" android:ellipsize="end" android:textsize="@dimen/twelve_sp" android:drawableleft="@drawable/ic_action_search" android:inputtype="text" android:hint="a long hint text need tuncated @ end in single line" android:id="@+id/edsearch" android:imeoptions="actionsearch" android:layout_alignparentleft="true" android:layout_toleftof="@+id/tvcancel" /> <textview android:id="@+id/tvcancel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:layout_gravity="center" android:layout_margin="@dimen/five_dp" android:text="@string/cancel" android:textsize="@dimen/twelve_sp" android:textcolor="@color/tw__composer_red" android:padding="@dimen/five_dp" android:layout_alignparentright="true" android:layout_centervertical="true"/> </relativelayout>
can please en-curtain issue facing. think had used every possible solution still hint not in single line.
these screenshots on device , xml tried follows
<autocompletetextview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="5dp" android:background="@color/white" android:padding="2dp" android:scrollhorizontally="true" android:drawablepadding="2dp" android:singleline="true" android:lines="1" android:maxlines="1" android:ellipsize="end" android:textsize="16sp" android:inputtype="text" android:drawableleft="@mipmap/ic_launcher" android:hint="a long hint text need tuncated @ end in single line" android:id="@+id/edsearch" android:imeoptions="actionsearch"/>
try setting android:inputtype="text"
on autocompletetextview
worked me
<autocompletetextview android:layout_width="match_parent" android:layout_height="wrap_content" android:maxlines="1" android:inputtype="text" android:ellipsize="end" android:imeoptions="actionnext" android:hint="this check if it's getting truncated , in single line or not"/>
Comments
Post a Comment