本文介紹了Android:單行中的EditText提示的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
為了在 EditText
中設置單行,我們使用 android:singleLine="true"
但我想為提示文本設置單行,它很大而且我想在一行中顯示它:
For setting the Single Line in EditText
we use android:singleLine="true"
but I want to set the single line for the Hint Text, it is large and I want to show it in a one line like:
http://google.myopenid.stackoverflow.com
我正在使用以下代碼:
<EditText android:id="@+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/defaultUrl"
android:singleLine="true" />
注意:defaultUrl
是動態且很長的 URL.
Note: defaultUrl
is dynamic and very long URL.
推薦答案
可以使用
android:ellipsize="end"
android:maxLines="1"
在單行中顯示您的提示文本,但您將無法看到整個文本,因為android:ellipsize="end"
在末尾截斷文本.
to show your hint text in single line but you wont be able to see the whole text because
android:ellipsize="end"
truncates the text at the end.
這篇關于Android:單行中的EditText提示的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!