【问题标题】:Wear OS: Get User Input [duplicate]Wear OS:获取用户输入 [重复]
【发布时间】:2022-01-03 09:53:06
【问题描述】:

我正在尝试从 Wear OS 应用中的用户那里获取文本输入。我正在寻找与以下屏幕截图类似的界面:
Google Notes
Play Store

我在文档中没有找到任何如何实现类似的东西。我遇到的最接近的是使用通知,如下所示:https://github.com/android/user-interface-samples/tree/d192c9d2000e43f63cca3eb1b9af05cf2e2ee867/Notifications
这与上面的屏幕截图非常相似,但问题是这只会生成通知,然后用户仍然必须点击。如果有办法让通知自动打开,那就太好了

【问题讨论】:

    标签: android notifications wear-os messaging


    【解决方案1】:

    这里已经提出了一个类似的问题并解决了这个问题:https://stackoverflow.com/a/70294785/17818420

    以下代码发送一个意图来获取用户输入

    val remoteInputs: List<RemoteInput> = listOf(
        RemoteInput.Builder("quick_reply").setLabel("Quick reply").build()
    )
    val intent: Intent = RemoteInputIntentHelper.createActionRemoteInputIntent()
    putRemoteInputsExtra(intent, remoteInputs)
    startActivityForResult(intent, 0)
    

    【讨论】:

      猜你喜欢
      • 2022-07-08
      • 1970-01-01
      • 2015-07-30
      • 2018-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-12
      • 2019-03-02
      相关资源
      最近更新 更多