【问题标题】:Making Edittext an address and search bar in one Android Eclipse在一个 Android Eclipse 中使 Edittext 成为地址和搜索栏
【发布时间】:2023-03-24 03:15:02
【问题描述】:

我正在尝试将编辑文本同时放入搜索栏和地址栏。此外,我不确定如何让用户在键盘上按 Enter 键来启动搜索,而不是手动触摸 go 按钮。

【问题讨论】:

    标签: android search webview android-edittext address-bar


    【解决方案1】:

    听起来您想为您的案例使用 IME 操作,以允许用户拥有一种由 Enter 键激活的“开始”按钮。官方 Android 指南上的这个页面应该可以帮助你:http://developer.android.com/guide/topics/ui/controls/text.html#Actions

    要检测 URL,请使用内置的 Java 类来执行此操作。见这里:How to detect the presence of URL in a string

    使用这两种方法,只需检查输入的文本是否为 URL。如果是,则使用它,否则您调用您的搜索方法并传入输入的文本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多