无法显示android搜索对话框
我是android的新手,我正在创建一个测试程序来测试android的无法显示android搜索对话框,android,search,dialog,Android,Search,Dialog,我是android的新手,我正在创建一个测试程序来测试android的搜索对话框。 这是searchable.xml配置文件 <?xml version="1.0" encoding="utf-8"?> <searchable xmlns:android="http://schemas.android.com/apk/res/android" android:label="Search" android:hint="Type text to sear
搜索对话框。
这是searchable.xml配置文件
<?xml version="1.0" encoding="utf-8"?>
<searchable
xmlns:android="http://schemas.android.com/apk/res/android"
android:label="Search"
android:hint="Type text to search">
</searchable>
这是testActivity.java初始化搜索对话框
package luan.com.bk;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
public class TestActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
但是当我在android模拟器上按下搜索键时,搜索栏没有显示,我怎么了?请帮忙。很抱歉,我的英语不好。请提供搜索按钮和搜索小部件或搜索对话框的实现,无论您选择什么。如果你不知道我在说什么,那么请看一下这个我已经展示了我所有的代码,我不知道你的答案更多?请帮助好的,所以问题是你没有实现搜索小部件或搜索对话框。我之前发布的链接中描述了这两个选项。如果没有这些,你将看不到任何东西,因为搜索只是你必须显示的另一个视图,Android不会为你创建一个。我很愚蠢,我已经解决了这个问题,它是将Android:label=“Search”Android:hint=“Type text to Search”更改为Android:label=“@string/xyz”Android:hint=“@string/xyz”>。谢谢你的帮助。^^^@VôDanh请将其添加为答案,然后将其标记为正确。谢谢!:)
package luan.com.bk;
import android.app.Activity;
import android.os.Bundle;
public class SearchActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
}
}
package luan.com.bk;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
public class TestActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}