如何使用SafeArgs将"null"设置为可为空的参数的默认值? [英] How to set `null` as the default value for a nullable argument using SafeArgs?

查看:174
本文介绍了如何使用SafeArgs将"null"设置为可为空的参数的默认值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该如何将null作为默认值传递给String参数,例如:

How should I pass in null as default value for a String argument such as this:

<argument
    android:name="profile_id"
    android:defaultValue="???"
    app:argType="string"
    app:nullable="true" />

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

If the argument is nullable there should be a way to pass in null right?

推荐答案

展示出很好的@null作品

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

这篇关于如何使用SafeArgs将"null"设置为可为空的参数的默认值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆