Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
    
    
  
  
    
    
  
  
CrossfadeDrawable
  public
  
  
  
  class
  CrossfadeDrawable
  
  
  
  
    extends Drawable
  
  
  
  
  
      implements
      
        Drawable.Callback
      
  
  
  
    
  
      This class is deprecated.
    consider using AnimationSet instead.
  
  Contains two child drawables and provides methods to directly adjust the blend between the two.
 
The base layer is always painted fully opaque, and the fading layer is adjusted according to
 the current progress value.
  
Summary
| Inherited methods | 
|---|
| 
    From class
      
        
          android.graphics.drawable.Drawable
        
      
      
  
  
  
    | 
        
        
        
        
        
        void | 
      applyTheme(Resources.Theme arg0)
       |  
  
  
    | 
        
        
        
        
        
        boolean | 
      canApplyTheme()
       |  
  
  
    | 
        
        
        
        
        
        void | 
      clearColorFilter()
       |  
  
  
    | 
        
        
        
        final
        
        Rect | 
      copyBounds()
       |  
  
  
    | 
        
        
        
        final
        
        void | 
      copyBounds(Rect arg0)
       |  
  
  
    | 
        
        
        static
        
        
        Drawable | 
      createFromPath(String arg0)
       |  
  
  
    | 
        
        
        static
        
        
        Drawable | 
      createFromResourceStream(Resources arg0, TypedValue arg1, InputStream arg2, String arg3, BitmapFactory.Options arg4)
       |  
  
  
    | 
        
        
        static
        
        
        Drawable | 
      createFromResourceStream(Resources arg0, TypedValue arg1, InputStream arg2, String arg3)
       |  
  
  
    | 
        
        
        static
        
        
        Drawable | 
      createFromStream(InputStream arg0, String arg1)
       |  
  
  
    | 
        
        
        static
        
        
        Drawable | 
      createFromXml(Resources arg0, XmlPullParser arg1)
       |  
  
  
    | 
        
        
        static
        
        
        Drawable | 
      createFromXml(Resources arg0, XmlPullParser arg1, Resources.Theme arg2)
       |  
  
  
    | 
        
        
        static
        
        
        Drawable | 
      createFromXmlInner(Resources arg0, XmlPullParser arg1, AttributeSet arg2, Resources.Theme arg3)
       |  
  
  
    | 
        
        
        static
        
        
        Drawable | 
      createFromXmlInner(Resources arg0, XmlPullParser arg1, AttributeSet arg2)
       |  
  
  
    | 
        abstract
        
        
        
        
        void | 
      draw(Canvas arg0)
       |  
  
  
    | 
        
        
        
        
        
        int | 
      getAlpha()
       |  
  
  
    | 
        
        
        
        final
        
        Rect | 
      getBounds()
       |  
  
  
    | 
        
        
        
        
        
        Drawable.Callback | 
      getCallback()
       |  
  
  
    | 
        
        
        
        
        
        int | 
      getChangingConfigurations()
       |  
  
  
    | 
        
        
        
        
        
        ColorFilter | 
      getColorFilter()
       |  
  
  
    | 
        
        
        
        
        
        Drawable.ConstantState | 
      getConstantState()
       |  
  
  
    | 
        
        
        
        
        
        Drawable | 
      getCurrent()
       |  
  
  
    | 
        
        
        
        
        
        Rect | 
      getDirtyBounds()
       |  
  
  
    | 
        
        
        
        
        
        void | 
      getHotspotBounds(Rect arg0)
       |  
  
  
    | 
        
        
        
        
        
        int | 
      getIntrinsicHeight()
       |  
  
  
    | 
        
        
        
        
        
        int | 
      getIntrinsicWidth()
       |  
  
  
    | 
        
        
        
        
        
        int | 
      getLayoutDirection()
       |  
  
  
    | 
        
        
        
        final
        
        int | 
      getLevel()
       |  
  
  
    | 
        
        
        
        
        
        int | 
      getMinimumHeight()
       |  
  
  
    | 
        
        
        
        
        
        int | 
      getMinimumWidth()
       |  
  
  
    | 
        abstract
        
        
        
        
        int | 
      getOpacity()
       |  
  
  
    | 
        
        
        
        
        
        Insets | 
      getOpticalInsets()
       |  
  
  
    | 
        
        
        
        
        
        void | 
      getOutline(Outline arg0)
       |  
  
  
    | 
        
        
        
        
        
        boolean | 
      getPadding(Rect arg0)
       |  
  
  
    | 
        
        
        
        
        
        int[] | 
      getState()
       |  
  
  
    | 
        
        
        
        
        
        Region | 
      getTransparentRegion()
       |  
  
  
    | 
        
        
        
        
        
        boolean | 
      hasFocusStateSpecified()
       |  
  
  
    | 
        
        
        
        
        
        void | 
      inflate(Resources arg0, XmlPullParser arg1, AttributeSet arg2, Resources.Theme arg3)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      inflate(Resources arg0, XmlPullParser arg1, AttributeSet arg2)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      invalidateSelf()
       |  
  
  
    | 
        
        
        
        
        
        boolean | 
      isAutoMirrored()
       |  
  
  
    | 
        
        
        
        
        
        boolean | 
      isFilterBitmap()
       |  
  
  
    | 
        
        
        
        
        
        boolean | 
      isProjected()
       |  
  
  
    | 
        
        
        
        
        
        boolean | 
      isStateful()
       |  
  
  
    | 
        
        
        
        final
        
        boolean | 
      isVisible()
       |  
  
  
    | 
        
        
        
        
        
        void | 
      jumpToCurrentState()
       |  
  
  
    | 
        
        
        
        
        
        Drawable | 
      mutate()
       |  
  
  
    | 
        
        
        
        
        
        void | 
      onBoundsChange(Rect arg0)
       |  
  
  
    | 
        
        
        
        
        
        boolean | 
      onLayoutDirectionChanged(int arg0)
       |  
  
  
    | 
        
        
        
        
        
        boolean | 
      onLevelChange(int arg0)
       |  
  
  
    | 
        
        
        
        
        
        boolean | 
      onStateChange(int[] arg0)
       |  
  
  
    | 
        
        
        static
        
        
        int | 
      resolveOpacity(int arg0, int arg1)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      scheduleSelf(Runnable arg0, long arg1)
       |  
  
  
    | 
        abstract
        
        
        
        
        void | 
      setAlpha(int arg0)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      setAutoMirrored(boolean arg0)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      setBounds(int arg0, int arg1, int arg2, int arg3)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      setBounds(Rect arg0)
       |  
  
  
    | 
        
        
        
        final
        
        void | 
      setCallback(Drawable.Callback arg0)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      setChangingConfigurations(int arg0)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      setColorFilter(int arg0, PorterDuff.Mode arg1)
       |  
  
  
    | 
        abstract
        
        
        
        
        void | 
      setColorFilter(ColorFilter arg0)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      setDither(boolean arg0)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      setFilterBitmap(boolean arg0)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      setHotspot(float arg0, float arg1)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      setHotspotBounds(int arg0, int arg1, int arg2, int arg3)
       |  
  
  
    | 
        
        
        
        final
        
        boolean | 
      setLayoutDirection(int arg0)
       |  
  
  
    | 
        
        
        
        final
        
        boolean | 
      setLevel(int arg0)
       |  
  
  
    | 
        
        
        
        
        
        boolean | 
      setState(int[] arg0)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      setTint(int arg0)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      setTintBlendMode(BlendMode arg0)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      setTintList(ColorStateList arg0)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      setTintMode(PorterDuff.Mode arg0)
       |  
  
  
    | 
        
        
        
        
        
        boolean | 
      setVisible(boolean arg0, boolean arg1)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      unscheduleSelf(Runnable arg0)
       |  | 
| 
    From class
      
        
          java.lang.Object
        
      
      
  
  
  
    | 
        
        
        
        
        
        Object | 
      clone()
       |  
  
  
    | 
        
        
        
        
        
        boolean | 
      equals(Object arg0)
       |  
  
  
    | 
        
        
        
        
        
        void | 
      finalize()
       |  
  
  
    | 
        
        
        
        final
        
        Class<?> | 
      getClass()
       |  
  
  
    | 
        
        
        
        
        
        int | 
      hashCode()
       |  
  
  
    | 
        
        
        
        final
        
        void | 
      notify()
       |  
  
  
    | 
        
        
        
        final
        
        void | 
      notifyAll()
       |  
  
  
    | 
        
        
        
        
        
        String | 
      toString()
       |  
  
  
    | 
        
        
        
        final
        
        void | 
      wait(long arg0, int arg1)
       |  
  
  
    | 
        
        
        
        final
        
        void | 
      wait(long arg0)
       |  
  
  
    | 
        
        
        
        final
        
        void | 
      wait()
       |  | 
|  | 
Public constructors
    CrossfadeDrawable
    
public CrossfadeDrawable ()
    
    
    
  
 
Public methods
    clearColorFilter
    
public void clearColorFilter ()
    
    
    
  
 
    draw
    
public void draw (Canvas canvas)
    
    
    
  
    
 
    getAlpha
    
public int getAlpha ()
    
    
    
  
    
 
    getChangingConfigurations
    
public int getChangingConfigurations ()
    
    
    
  
    
 
    getIntrinsicHeight
    
public int getIntrinsicHeight ()
    
    
    
  
    
 
    getIntrinsicWidth
    
public int getIntrinsicWidth ()
    
    
    
  
    
 
    getOpacity
    
public int getOpacity ()
    
    
    
  
    
 
    invalidateDrawable
    
public void invalidateDrawable (Drawable who)
    
    
    
  
    
 
    isStateful
    
public boolean isStateful ()
    
    
    
  
    
 
    jumpToCurrentState
    
public void jumpToCurrentState ()
    
    
    
  
 
    scheduleDrawable
    
public void scheduleDrawable (Drawable who, 
                Runnable what, 
                long when)
    
    
    
  
    
    | Parameters | 
|---|
      
        | who | Drawable | 
      
        | what | Runnable | 
      
        | when | long | 
    
 
    setAlpha
    
public void setAlpha (int alpha)
    
    
    
  
    
 
    setBase
    
public void setBase (Drawable d)
    
    
    
  Sets the image for the base layer. This drawable's opacity remains fixed. It's fully visible
 when progress == 0, and completely obscured when progress == 1.
    
 
    setChangingConfigurations
    
public void setChangingConfigurations (int configs)
    
    
    
  
    
 
    setColorFilter
    
public void setColorFilter (ColorFilter cf)
    
    
    
  
    
    | Parameters | 
|---|
      
        | cf | ColorFilter | 
    
 
    setColorFilter
    
public void setColorFilter (int color, 
                PorterDuff.Mode mode)
    
    
    
  
    
    | Parameters | 
|---|
      
        | color | int | 
      
        | mode | PorterDuff.Mode | 
    
 
    setDither
    
public void setDither (boolean dither)
    
    
    
  
    
    | Parameters | 
|---|
      
        | dither | boolean | 
    
 
    setFading
    
public void setFading (Drawable d)
    
    
    
  Sets the image for the fading layer. This drawable's opacity will vary directly proportionally
 to the progress value. It's invisible when progress == 0 and fully opaque when progress == 1.
    
 
    setFilterBitmap
    
public void setFilterBitmap (boolean filter)
    
    
    
  
    
    | Parameters | 
|---|
      
        | filter | boolean | 
    
 
    setProgress
    
public void setProgress (float progress)
    
    
    
  
    
    | Parameters | 
|---|
      
        | progress | float | 
    
 
    unscheduleDrawable
    
public void unscheduleDrawable (Drawable who, 
                Runnable what)
    
    
    
  
    
    | Parameters | 
|---|
      
        | who | Drawable | 
      
        | what | Runnable | 
    
 
Protected methods
    onBoundsChange
    
protected void onBoundsChange (Rect bounds)
    
    
    
  
    
 
    onLevelChange
    
protected boolean onLevelChange (int level)
    
    
    
  
    
    
 
    onStateChange
    
protected boolean onStateChange (int[] state)
    
    
    
  
    
    
 
 
 
  
  
    
  
 
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-02-10 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[]]