Android mvvm @{asset.total ?? String.valueOf(0.00)} null时显示值的问题
PHPz
PHPz 2017-04-18 09:06:22
0
3
694

这个运行出来,total == null时,textview显示的是 0.0 ,而不是 0.00 ,怎么显示0.00

PHPz
PHPz

学习是最好的投资!

reply all(3)
黄舟

Your total可是String类型变量?如果是,检查你的初始化是不是已经设置为“0.0” is worth it.

阿神

Try directly String.valueOf(0.00) 写成 '0.00',
or by using static variables:

android:visibility="@{user.isAdult ? View.VISIBLE : View.GONE}"

Reference: Data Binding Library

洪涛

No, a red line will be reported

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template