android - 如何在 XML 中添加 OR 运算符?

标签 android xml data-binding operator-keyword android-databinding

我找到了一些关于如何实现 AND 的资源, less thangreater than用于 Android 数据绑定(bind)的 XML 中的运算符。
& -> &amp;< -> &lt;> -> &gt;
但是,如何添加 OR运算符(operator)?我在 Android 官方文档中找不到相关信息。

我访问过这些网站

StackOverflow --- android databinding using "&&" logical operator - Stack Overflow

StackOverflow --- android-databinding-using-logical-operator

Escape And(&&) Operator In Android Data Binding

我的预期结果:

<View
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:visibility="@{viewModel.fooBoolOne ||  viewModel.fooBoolTwo ? View.VISIBLE : View.GONE}"/>```

最佳答案

您可以使用 || xml 中的运算符,无需任何更改。
例子 :-

10 || 12

关于android - 如何在 XML 中添加 OR 运算符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56999399/

相关文章:

android 以国际格式转换电话号码

Android:键盘打开时 webview 滚动不够

android - 无法将 Nexus 4 连接到 adb : unauthorized

java - 为 Android webview 隔离网站 DIV

ASP.NET 使用存储过程填充 ListView

javascript - 数据表行选择的 Angular 数据绑定(bind)

android - 谷歌 openID 登录集成

java - Eclipse 和 GWT 在错误的包中寻找继承的模块,尽管 gwt.xml 文件具有正确的路径?

sql-server - SQL Server 2012 创建具有可变数量属性的 xml

c# - WPF双向数据绑定(bind)列表框在WPF中建模无法获取选定值