尝试将双值绑定到使用字符串资源查看。
尝试1:
layout.xml
android:text="@{@string/user_popularity(Double.toString(user.popularity))}"string.xml
<string name="user_popularity">Popularity: %s</string>尝试2:
layout.xml
android:text="@{String.format(@string/user_popularity, user.popularity)}"string.xml
<string name="user_popularity">Popularity: %.1f</string>错误:
Error:(167, 107) error: double cannot be dereferenced以下是一些类似的问题
发布于 2017-08-04 11:29:04
其实很简单,我的错我做错了。这是解决办法。
<string name="user_popularity">Popularity: %.1f</string>
android:text="@{@string/user_popularity(user.popularity)}"https://stackoverflow.com/questions/45467052
复制相似问题