[英]Data binding with ternary operator to align views
Can I use data binding with ternary operator to align views. 我可以将数据绑定与三元运算符一起使用来对齐视图。
android:layout_toLeftOf=
"@{value.getUnit().equals(@string/mb)?@+id/lyt_value:@+id/lyt_value2}"
Above code gives compilation error 'expr expected' 上面的代码给出了编译错误“ expr期望”
尝试这个:
android:layout_toLeftOf="@{value.getUnit().equals(@string/mb)?@id/lyt_value:@id/lyt_value2}"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.