如何将数据绑定与ratingbar';s android:progressBackgroundTint属性?
我得到了以下如何将数据绑定与ratingbar';s android:progressBackgroundTint属性?,android,data-binding,ratingbar,android-databinding,Android,Data Binding,Ratingbar,Android Databinding,我得到了以下评级条,并尝试使用数据绑定设置其android:progressBackgroundTint属性,但它给了我以下编译错误: 错误:(61,39)找不到属性的setter 参数类型为int on的“android:progressBackgroundTint” android.widget.RatingBar 你能在这里上太空课吗!空格类太大了,我只是在这里加了一部分。颜色资源不应该是十六进制字符串吗?由于xml属性接受十六进制字符串,请在此处指定空格类!空格类太大了,我只是在这里加了
评级条
,并尝试使用数据绑定设置其android:progressBackgroundTint
属性,但它给了我以下编译错误:
错误:(61,39)找不到属性的setter
参数类型为int on的“android:progressBackgroundTint”
android.widget.RatingBar
你能在这里上太空课吗!空格类太大了,我只是在这里加了一部分。颜色资源不应该是十六进制字符串吗?由于xml属性接受十六进制字符串,请在此处指定空格类!空格类太大了,我只是在这里加了一部分。颜色资源不应该是十六进制字符串吗?因为xml属性接受十六进制字符串。
<RatingBar
android:id="@+id/item_rating_bar"
style="@style/StarRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_item_space_title"
android:layout_marginBottom="2dp"
android:backgroundTint="@{space.themeColorResourceInt}"
android:clickable="false"
android:isIndicator="true"
android:progressBackgroundTint="@{space.themeColorResourceInt}"
android:progressTint="@{space.themeColorResourceInt}"
android:rating="2.5"
android:secondaryProgressTint="@{space.themeColorResourceInt}"
tools:rating="2.5"/>
...
@Nullable
@Bindable
public int getThemeColorResourceInt() {
// lazy instiantate
if (themeColorResourceInt > -1) {
return themeColorResourceInt;
}
if (themeColor != null) {
themeColorResourceInt = Color.parseColor(themeColor);
return themeColorResourceInt;
}
if (spaceId > -1) {
try {
String floorSpaceThemeColor = SpaceBean.getInstance().getCurrentFloor().getSpaceWithSpaceId(spaceId).getThemeColor();
themeColorResourceInt = Color.parseColor(floorSpaceThemeColor);
return themeColorResourceInt;
} catch (NullPointerException ex) {
ex.printStackTrace();
Logger.getLogger().e(ex.getLocalizedMessage());
}
}
return MainApplication.sContext.getResources().getColor(R.color.btn_brown);
}
...