【问题标题】:Handling Array Query Params Using Navigation Component Deep Linking使用导航组件深度链接处理数组查询参数
【发布时间】:2020-06-07 05:02:15
【问题描述】:

我在我的项目中使用单个活动结构,并且我想使用导航组件处理深度(应用程序)链接。一切都很好,但我无法处理数组查询参数。我想将 complex_types 作为字符串数组。

现有网址:

my.example.com/?guests=1&complex_types=hotel&complex_types=motel

nav_graph.xml:

     <fragment
        android:id="@+id/complexFragment"
        android:name="com.the.example.packagename.ComplexFragment"
        android:label="ComplexFragment">
        <argument
            android:name="guests"
            android:defaultValue="1"
            app:argType="integer" />
        <argument
            android:name="complexFilters"
            app:argType="???" />
        <deepLink
            android:id="@+id/deepLink_complex_fragment"
            app:uri="my.example.com/?guests={guests}&amp;complex_types={complexFilters}" />
    </fragment>

我不知道在 complexFilters 参数中必须使用什么类型的 argType 而不是 ???

【问题讨论】:

  • 在android编辑器中有一个数组复选框

标签: android android-architecture-navigation android-navigation-graph


【解决方案1】:

在 android 编辑器中有一个用于数组的复选框,或者你

而在xml导航图中会是这样的

   <argument
        android:name="images"
        android:defaultValue="@null"
        app:argType="string[]"
        app:nullable="true" />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-03-02
    • 1970-01-01
    • 2022-06-27
    • 1970-01-01
    • 1970-01-01
    • 2021-09-03
    • 1970-01-01
    相关资源
    最近更新 更多