如何使用SafeArgs将“ null”设置为可为空的参数的默认值?

Kay*_*n N 10 android android-architecture-navigation androidx

我应该如何将null这样的String参数作为默认值传递:

<argument
    android:name="profile_id"
    android:defaultValue="???"
    app:argType="string"
    app:nullable="true" />
Run Code Online (Sandbox Code Playgroud)

如果参数为空,应该有一种传递方法null吗?

Kay*_*n N 21

证明是好的老@null作品

<argument
    android:name="profile_id"
    android:defaultValue="@null"
    app:argType="string"
    app:nullable="true" />
Run Code Online (Sandbox Code Playgroud)

  • 提交 [此文档问题](https://issuetracker.google.com/issues/120627532) 以确保官方文档中提到了这一点。 (5认同)