public class

ColorImageButton

extends ImageButton
java.lang.Object
   ↳ android.view.View
     ↳ android.widget.ImageView
       ↳ android.widget.ImageButton
         ↳ com.droidux.pack.commons.widget.ColorImageButton

Class Overview

An ImageButton widget with tinted/colorized background.

Summary

XML Attributes
Attribute Name Related Method Description
dux_color setTintColor(ColorStateList) Specifies a color. 
[Expand]
Inherited Constants
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
ColorImageButton(Context context)
ColorImageButton(Context context, AttributeSet attrs)
ColorImageButton(Context context, AttributeSet attrs, int defStyle)
Public Methods
int getCurrentTintColor()
Gets the currently used tint color associated with this color button.
ColorStateList getTintColors()
Gets the tint colors associated with this color button.
void onRestoreInstanceState(Parcelable state)
Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState().
Parcelable onSaveInstanceState()
Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state.
void setTintColor(int color, boolean useForAllStates)
Colorize the background with the specified tint color.
void setTintColor(int color)
Colorize the background with the specified tint color.
void setTintColor(ColorStateList colors)
Colorize the background with the specified tint color.
[Expand]
Inherited Methods
From class android.widget.ImageButton
From class android.widget.ImageView
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource

XML Attributes

dux_color

Since: API Level

Specifies a color.

May be a reference to another resource, in the form "@[+][package:]type:name" or to a theme attribute in the form "?[package:][type:]name".

May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".

Public Constructors

public ColorImageButton (Context context)

Since: API Level 2.5

public ColorImageButton (Context context, AttributeSet attrs)

Since: API Level 2.5

public ColorImageButton (Context context, AttributeSet attrs, int defStyle)

Since: API Level 2.5

Public Methods

public int getCurrentTintColor ()

Since: API Level 2.5

Gets the currently used tint color associated with this color button.

Returns
  • The currently used tint color.

public ColorStateList getTintColors ()

Since: API Level 2.5

Gets the tint colors associated with this color button.

Returns
  • The tint colors.

public void onRestoreInstanceState (Parcelable state)

Since: API Level 2.5

Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState(). This function will never be called with a null state.

Parameters
state The frozen state that had previously been returned by onSaveInstanceState().

public Parcelable onSaveInstanceState ()

Since: API Level 2.5

Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state. This state should only contain information that is not persistent or can not be reconstructed later. For example, you will never store your current position on screen because that will be computed again when a new instance of the view is placed in its view hierarchy.

Some examples of things you may store here: the current cursor position in a text view (but usually not the text itself since that is stored in a content provider or other persistent storage), the currently selected item in a list view.

Returns
  • Returns a Parcelable object containing the view's current dynamic state, or null if there is nothing interesting to save. The default implementation returns null.

public void setTintColor (int color, boolean useForAllStates)

Since: API Level 2.5

Colorize the background with the specified tint color. Tips: for better result, use a grayscale background.

Related XML Attributes
Parameters
color The button's background tint.
useForAllStates If true, the specified color will be used to colorize on all states of background drawable.

public void setTintColor (int color)

Since: API Level 2.5

Colorize the background with the specified tint color. Tips: for better result, use a grayscale background.

Related XML Attributes
Parameters
color The button's background tint.

public void setTintColor (ColorStateList colors)

Since: API Level 2.5

Colorize the background with the specified tint color. Tips: for better result, use a grayscale background.

Related XML Attributes
Parameters
colors The button's background tint.