有誰知道如何動態設置android搜索對話框提示? T的嘗試做這樣的事情:動態設置搜索提示
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/search_label"
android:hint="@string/search_hint"
android:id="@+id/search_dialog_text">
</searchable>
某處:
@Override
public boolean onSearchRequested() {
Bundle appSearchData = new Bundle();
appSearchData.putString("SomeSpecificParam", SomeClass.class.getName());
startSearch("", false, appSearchData, false);
EditText text = (EditText)findViewById(R.id.search_dialog_text);
text.setHint("Search something else");
return true;
}
但文本等於空。
所以期待你的建議。謝謝。
非常有趣的黑客。凌亂,但似乎有效。你能想出一種方法來允許這種動態發生嗎?即在運行時更新搜索提示?例如格式化一個提示字符串,其中包含正在搜索的項目的數量 – ohhorob 2010-12-14 20:06:18