Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.

Converters

public class Converters
extends Object

java.lang.Object
   ↳ android.databinding.adapters.Converters


Build in converters to converts for color.

Summary

Public constructors

Converters()

Public methods

static ColorStateList convertColorToColorStateList(int color)

Converts int color into a ColorStateList.

static ColorDrawable convertColorToDrawable(int color)

Converts int color into a ColorDrawable.

Inherited methods

From class java.lang.Object

Public constructors

Converters

Converters ()

Public methods

convertColorToColorStateList

ColorStateList convertColorToColorStateList (int color)

Converts int color into a ColorStateList.

Parameters
color int: The integer representation of the color.

Returns
ColorStateList ColorStateList from the single color

convertColorToDrawable

ColorDrawable convertColorToDrawable (int color)

Converts int color into a ColorDrawable.

Parameters
color int: The integer representation of the color.

Returns
ColorDrawable ColorDrawable matching the color