public class

DraweeView

extends ImageView
java.lang.Object
   ↳ android.view.View
     ↳ android.widget.ImageView
       ↳ com.facebook.drawee.view.DraweeView<DH extends com.facebook.drawee.interfaces.DraweeHierarchy>
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

View that displays a DraweeHierarchy.

Hierarchy should be set prior to using this view. See setHierarchy. Because creating a hierarchy is an expensive operation, it is recommended this be done once per view, typically near creation time.

In order to display an image, controller has to be set. See setController.

Although ImageView is subclassed instead of subclassing View directly, this class does not support ImageView's setImageXxx, setScaleType and similar methods. Extending ImageView is a short term solution in order to inherit some of its implementation (padding calculations, etc.). This class is likely to be converted to extend View directly in the future, so avoid using ImageView's methods and properties.

Summary

[Expand]
Inherited Constants
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
DraweeView(Context context)
DraweeView(Context context, AttributeSet attrs)
DraweeView(Context context, AttributeSet attrs, int defStyle)
DraweeView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Public Methods
float getAspectRatio()
Gets the desired aspect ratio (w/h).
DraweeController getController()
Gets the controller if set, null otherwise.
DH getHierarchy()
Gets the hierarchy if set, throws NPE otherwise.
Drawable getTopLevelDrawable()
Gets the top-level drawable if hierarchy is set, null otherwise.
boolean hasController()
Returns whether the controller is set or not.
boolean hasHierarchy()
Returns whether the hierarchy is set or not.
void onFinishTemporaryDetach()
void onStartTemporaryDetach()
boolean onTouchEvent(MotionEvent event)
void setAspectRatio(float aspectRatio)
Sets the desired aspect ratio (w/h).
void setController(DraweeController draweeController)
Sets the controller.
static void setGlobalLegacyVisibilityHandlingEnabled(boolean legacyVisibilityHandlingEnabled)
void setHierarchy(DH hierarchy)
Sets the hierarchy.
void setImageBitmap(Bitmap bm)
This method is deprecated. Use setController(DraweeController) instead.
void setImageDrawable(Drawable drawable)
This method is deprecated. Use setController(DraweeController) instead.
void setImageResource(int resId)
This method is deprecated. Use setController(DraweeController) instead.
void setImageURI(Uri uri)
This method is deprecated. Use setController(DraweeController) instead.
void setLegacyVisibilityHandlingEnabled(boolean legacyVisibilityHandlingEnabled)
String toString()
Protected Methods
void doAttach()
Does the actual work of attaching.
void doDetach()
Does the actual work of detaching.
void onAttach()
Called by the system to attach.
void onAttachedToWindow()
void onDetach()
Called by the system to detach.
void onDetachedFromWindow()
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
void onVisibilityChanged(View changedView, int visibility)
[Expand]
Inherited Methods
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

Public Constructors

public DraweeView (Context context)

public DraweeView (Context context, AttributeSet attrs)

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

public DraweeView (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Public Methods

public float getAspectRatio ()

Gets the desired aspect ratio (w/h).

public DraweeController getController ()

Gets the controller if set, null otherwise.

public DH getHierarchy ()

Gets the hierarchy if set, throws NPE otherwise.

public Drawable getTopLevelDrawable ()

Gets the top-level drawable if hierarchy is set, null otherwise.

public boolean hasController ()

Returns whether the controller is set or not.

public boolean hasHierarchy ()

Returns whether the hierarchy is set or not.

public void onFinishTemporaryDetach ()

public void onStartTemporaryDetach ()

public boolean onTouchEvent (MotionEvent event)

public void setAspectRatio (float aspectRatio)

Sets the desired aspect ratio (w/h).

public void setController (DraweeController draweeController)

Sets the controller.

public static void setGlobalLegacyVisibilityHandlingEnabled (boolean legacyVisibilityHandlingEnabled)

public void setHierarchy (DH hierarchy)

Sets the hierarchy.

public void setImageBitmap (Bitmap bm)

This method is deprecated.
Use setController(DraweeController) instead.

Use this method only when using this class as an ordinary ImageView.

public void setImageDrawable (Drawable drawable)

This method is deprecated.
Use setController(DraweeController) instead.

Use this method only when using this class as an ordinary ImageView.

public void setImageResource (int resId)

This method is deprecated.
Use setController(DraweeController) instead.

Use this method only when using this class as an ordinary ImageView.

public void setImageURI (Uri uri)

This method is deprecated.
Use setController(DraweeController) instead.

Use this method only when using this class as an ordinary ImageView.

public void setLegacyVisibilityHandlingEnabled (boolean legacyVisibilityHandlingEnabled)

public String toString ()

Protected Methods

protected void doAttach ()

Does the actual work of attaching.

Non-test subclasses should NOT override. Use onAttach for custom code.

protected void doDetach ()

Does the actual work of detaching.

Non-test subclasses should NOT override. Use onDetach for custom code.

protected void onAttach ()

Called by the system to attach. Subclasses may override.

protected void onAttachedToWindow ()

protected void onDetach ()

Called by the system to detach. Subclasses may override.

protected void onDetachedFromWindow ()

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

protected void onVisibilityChanged (View changedView, int visibility)