databing中@{true ? @mipmap/icon...}报错,只能写drawable么
来源:5-2 databinding数据安全绑定及构建列表图片布局2

精慕门5686350
2020-06-21
<android.support.design.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@{feed.ugc.likeCount > 0 ? StringConvert.convertFeedUgc(feed.ugc.likeCount) : null}"
android:textColor="@{feed.ugc.likeCount > 0 ? @color/color_theme : @color/color_3d3}"
android:textSize="@dimen/sp_12"
app:icon="@{feed.ugc.hasLiked ? @mipmap/icon_cell_liked : @mipmap/icon_cell_like}"
app:iconGravity="textStart"
app:iconPadding="@dimen/dp_4"
tools:icon="@mipmap/icon_cell_like"
tools:text="100" />
写回答
2回答
-
Casanova_wb
2020-12-29
无情的不支持@mipmap
00 -
LovelyChubby
2020-06-21
可以使用mipmap的,报错信息贴
012020-06-27
相似问题