【问题标题】:does binding nullable string in xml causes error?在 xml 中绑定可为空的字符串会导致错误吗?
【发布时间】:2020-11-19 05:29:12
【问题描述】:

我正在使用可以为空的字符串 hasName: String? 并在 xml 中绑定为

android:visibility="@{myModel. hasName().equals(`true`)??View.GONE : View.VISIBLE}"

这对吗?

在上述行中,如果 hasName 为空会发生什么?

【问题讨论】:

    标签: android kotlin android-databinding


    【解决方案1】:

    我不确定您的语句是否会编译。您的 ??: 无法按预期使用。

    【讨论】:

      猜你喜欢
      • 2013-11-29
      • 2023-03-10
      • 1970-01-01
      • 2014-04-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-02
      • 1970-01-01
      相关资源
      最近更新 更多