gpt4 book ai didi

android - 如何在 Android 中设置搜索 View 文本

转载 作者:太空狗 更新时间:2023-10-29 16:27:36 25 4
gpt4 key购买 nike

我试图找到一种方法来为 SearchView 设置文本,但找不到任何东西?有谁知道这样做的任何方法吗?例如像这样的东西

 searchView.setText("blah blah");

最佳答案

尝试使用 setQuery

setQuery(CharSequence query, boolean submit)

Sets a query string in the text field and optionally submits the query as well.

示例代码

使用 intent 将标题发送给其他 Activity

Intent intent=new Intent(this, OtherActivity.class);
intent.putExtra("TITLE", "NILESH");
startActivity(intent);

像这样在其他 Activity 中检索标题

String str = getIntent().getStringExtra("TITLE");
searchView.setQuery(str, false);

关于android - 如何在 Android 中设置搜索 View 文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46294168/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com