[英]Text in autocompletetextview to be highlighted or deleted when the user clicks on the AutoCompleteTextView
當用戶單擊ACTV並找到他要搜索的內容時,他再次選擇ACTV的唯一原因就是要搜索其他內容。 我正在尋找一種方法,當用戶在ACTV上進行搜索並且用戶在ACTV上單擊以再次寫入時,搜索文本位於ACTV字段中(建議菜單已關閉),當前文本將突出顯示或刪除單擊可打開鍵盤,供用戶開始輸入他們的新搜索。
嘗試這個:
AutoCompleteTextView search = (AutoCompleteTextView) findViewById(R.id.search);
search.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Do what ever you want
(AutoCompleteTextView) findViewById(R.id.search).setText("");
}
});
突出顯示:
android:selectAllOnFocus="true"
(xml屬性)
要么
autoCompleteTextView.setSelectAllOnFocus(true);
(編程)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.