小编Bor*_*ris的帖子

动态设置搜索提示

有谁知道如何动态设置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>
Run Code Online (Sandbox Code Playgroud)

某处:

@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;
}
Run Code Online (Sandbox Code Playgroud)

但是文本等于null.

所以期待你的建议.谢谢.

android android-searchmanager

11
推荐指数
1
解决办法
5353
查看次数

标签 统计

android ×1

android-searchmanager ×1