Android examples for User Interface:Layout
post Layout on View
//package com.java2s; import android.view.View; import android.view.ViewTreeObserver; public class Main { public static void postLayout(final View view, final Runnable runnable) { view.getViewTreeObserver().addOnGlobalLayoutListener( new ViewTreeObserver.OnGlobalLayoutListener() { @Override// ww w . java 2s . c om public void onGlobalLayout() { //noinspection deprecation view.getViewTreeObserver() .removeGlobalOnLayoutListener(this); view.post(runnable); } }); } }