Android examples for User Interface:View
on View Pre Draw
//package com.java2s; import android.view.View; import android.view.ViewTreeObserver; public class Main { public static void onPreDraw(final View view, final ViewTreeObserver.OnPreDrawListener listener) { view.getViewTreeObserver().addOnPreDrawListener( new ViewTreeObserver.OnPreDrawListener() { @Override/* w w w. j a v a 2 s . c om*/ public boolean onPreDraw() { if (view.getViewTreeObserver().isAlive()) { view.getViewTreeObserver() .removeOnPreDrawListener(this); } return listener.onPreDraw(); } }); } }