如何摆脱可搜索字典类应用程序中的中间页面
我正在开发一个搜索应用程序,因为我是初学者,所以我决定从可搜索字典示例开始,这与我想要实现的目标非常相似。让它工作,但我有一个问题:示例最初加载一个空白页面,告诉用户按搜索按钮开始执行搜索。一旦按下搜索,就会加载一个新页面,顶部有一个搜索字段和按钮,允许用户开始搜索内容。
我想要做的是摆脱该中间页面,以便从头开始加载搜索字段和按钮,在应用程序启动时加载的第一个屏幕上。关于如何做到这一点有什么想法吗?详细的说明/示例将不胜感激,因为我是 Android 编程的初学者。
多谢!
I am working on a search app and since I am a beginner, I decided to start from the searchable dictionary sample, which is quite similar to what I'm trying to achieve. Got it to work, but I have a problem: the sample loads a blank page initially, telling the user to press on the search button to start performing a search. Once search is pressed, a new page loads with a search field and button on top, allowing the user to start searching for stuff.
What I want to do is get rid of that intermediary page, so that the search field and button are loaded from the beginning, on the very first screen the app loads when started. Any ideas on how to do this? Detailed instructions/examples would be greatly appreciated, as I am a beginner in Android programming.
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需从您的 Activity 中调用 onSearchRequested() 即可打开搜索屏幕。该方法存在于扩展 Activity 的每个类中。然后搜索控件就会覆盖在当前屏幕的顶部。
Just call onSearchRequested() from your Activity that should open the search screen This method exists in every class that extends Activity. Search controls are then just overlayed on top of the current screen.