# ViewTreeObserver.OnPreDrawListener

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Methods](https://developer.android.com/reference/android/view/ViewTreeObserver.OnPreDrawListener#pubmethods)  

# ViewTreeObserver.OnPreDrawListener

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/view/ViewTreeObserver.OnPreDrawListener "View this page in Kotlin")\|Java

`
public
static


interface
ViewTreeObserver.OnPreDrawListener
`  
`


`

|-------------------------------------------------|
| android.view.ViewTreeObserver.OnPreDrawListener |

|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known indirect subclasses [AutoCompleteTextView](https://developer.android.com/reference/android/widget/AutoCompleteTextView),[Button](https://developer.android.com/reference/android/widget/Button),[CheckBox](https://developer.android.com/reference/android/widget/CheckBox),[CheckedTextView](https://developer.android.com/reference/android/widget/CheckedTextView),[Chronometer](https://developer.android.com/reference/android/widget/Chronometer),[CompoundButton](https://developer.android.com/reference/android/widget/CompoundButton),[DigitalClock](https://developer.android.com/reference/android/widget/DigitalClock),[EditText](https://developer.android.com/reference/android/widget/EditText),[ExtractEditText](https://developer.android.com/reference/android/inputmethodservice/ExtractEditText),[MultiAutoCompleteTextView](https://developer.android.com/reference/android/widget/MultiAutoCompleteTextView),[RadioButton](https://developer.android.com/reference/android/widget/RadioButton),[Switch](https://developer.android.com/reference/android/widget/Switch),[TextClock](https://developer.android.com/reference/android/widget/TextClock),[TextView](https://developer.android.com/reference/android/widget/TextView),[ToggleButton](https://developer.android.com/reference/android/widget/ToggleButton) |---------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [AutoCompleteTextView](https://developer.android.com/reference/android/widget/AutoCompleteTextView)           | An editable text view that shows completion suggestions automatically while the user is typing.                                                                                                                                                                               | | [Button](https://developer.android.com/reference/android/widget/Button)                                       | A user interface element the user can tap or click to perform an action.                                                                                                                                                                                                      | | [CheckBox](https://developer.android.com/reference/android/widget/CheckBox)                                   | A checkbox is a specific type of two-states button that can be either checked or unchecked.                                                                                                                                                                                   | | [CheckedTextView](https://developer.android.com/reference/android/widget/CheckedTextView)                     | An extension to[TextView](https://developer.android.com/reference/android/widget/TextView)that supports the[Checkable](https://developer.android.com/reference/android/widget/Checkable)interface and displays.                                                               | | [Chronometer](https://developer.android.com/reference/android/widget/Chronometer)                             | Class that implements a simple timer.                                                                                                                                                                                                                                         | | [CompoundButton](https://developer.android.com/reference/android/widget/CompoundButton)                       | A button with two states, checked and unchecked.                                                                                                                                                                                                                              | | [DigitalClock](https://developer.android.com/reference/android/widget/DigitalClock)                           | *This class was deprecated in API level 17. It is recommended you use[TextClock](https://developer.android.com/reference/android/widget/TextClock)instead.*                                                                                                                   | | [EditText](https://developer.android.com/reference/android/widget/EditText)                                   | A user interface element for entering and modifying text.                                                                                                                                                                                                                     | | [ExtractEditText](https://developer.android.com/reference/android/inputmethodservice/ExtractEditText)         | Specialization of[EditText](https://developer.android.com/reference/android/widget/EditText)for showing and interacting with the extracted text in a full-screen input method.                                                                                                | | [MultiAutoCompleteTextView](https://developer.android.com/reference/android/widget/MultiAutoCompleteTextView) | An editable text view, extending[AutoCompleteTextView](https://developer.android.com/reference/android/widget/AutoCompleteTextView), that can show completion suggestions for the substring of the text where the user is typing instead of necessarily for the entire thing. | | [RadioButton](https://developer.android.com/reference/android/widget/RadioButton)                             | A radio button is a two-states button that can be either checked or unchecked.                                                                                                                                                                                                | | [Switch](https://developer.android.com/reference/android/widget/Switch)                                       | A Switch is a two-state toggle widget.                                                                                                                                                                                                                                        | | [TextClock](https://developer.android.com/reference/android/widget/TextClock)                                 | `TextClock`can display the current date and/or time as a formatted string.                                                                                                                                                                                                    | | [TextView](https://developer.android.com/reference/android/widget/TextView)                                   | A user interface element that displays text to the user.                                                                                                                                                                                                                      | | [ToggleButton](https://developer.android.com/reference/android/widget/ToggleButton)                           | Displays checked/unchecked states as a button with a "light" indicator and by default accompanied with the text "ON" or "OFF".                                                                                                                                                | |

<br />

*** ** * ** ***

Interface definition for a callback to be invoked when the view tree is about to be drawn.

## Summary

|                                                                                                  ### Public methods                                                                                                  ||
|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract boolean` | ` `[onPreDraw](https://developer.android.com/reference/android/view/ViewTreeObserver.OnPreDrawListener#onPreDraw())`() ` Callback method to be invoked when the view tree is about to be drawn. |

## Public methods

### onPreDraw

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract boolean onPreDraw ()
```

Callback method to be invoked when the view tree is about to be drawn. At this point, all views in the tree have been measured and given a frame. Clients can use this to adjust their scroll bounds or even to request a new layout before drawing occurs.

<br />

|                                           Returns                                           ||
|-----------|----------------------------------------------------------------------------------|
| `boolean` | Return true to proceed with the current drawing pass, or false to cancel. <br /> |

**See also:**

- [View.onMeasure(int, int)](https://developer.android.com/reference/android/view/View#onMeasure(int,%20int))
- [View.onLayout(boolean, int, int, int, int)](https://developer.android.com/reference/android/view/View#onLayout(boolean,%20int,%20int,%20int,%20int))
- [View.onDraw(Canvas)](https://developer.android.com/reference/android/view/View#onDraw(android.graphics.Canvas))