本文介紹了Android EditText 背景文字的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
有沒有辦法設置 EditText 的背景文本?例如,我有一個帶有 2 個 EditText 視圖的登錄屏幕,一個用于用戶名,一個用于密碼.我希望在 EditText 中寫入文本用戶名"和密碼",一旦用戶觸摸它們,文本就會消失,但一旦用戶刪除了自己的條目,文本就會重新出現.
Is there a way to set the background text of an EditText? for instance, I have a login screen with 2 EditText views, one for username and one for password. I want the text "Username" and "Password" be written inside the EditText, and once the user touches those the text disappears but once user deleted his own entry, text re-appears.
是否有一個屬性,或者我應該自己用事件和東西來實現它?
Is there a property for that or should I implement this on my own with events and stuff?
推薦答案
hint
屬性會為你解決這個問題.
The hint
property will take care of that for you.
這篇關于Android EditText 背景文字的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!