Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/178.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将数据绑定与ratingbar';s android:progressBackgroundTint属性?_Android_Data Binding_Ratingbar_Android Databinding - Fatal编程技术网

如何将数据绑定与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);
}
...