I am trying to write a custom setter for SwipeRefreshLayout's
setColorScheme(int... colors).
But it seems that its parameter is varargs.
I can only bind a single color now like the following:
@BindingAdapter("app:colorSchemeResources")
public static void bindRefreshColor(SwipeRefreshLayout swipeRefreshLayout, int colorResId) {
swipeRefreshLayout.setColorSchemeColors(colorResId);
}
xml:
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:colorSchemeResources ="@{@color/primary}"
/>
My question is:
How can I write a custom setter for varargs?
How to bind varargs in the xml file?