immp8q
Last Updated: February 25, 2016
·
9.554K
· ignaciogs
Bc0b374c428b10843153778f8542784c

Get height of a view in onCreate method (Android)

final LinearLayout layout = (LinearLayout) findViewById(R.id.layout);
final ViewTreeObserver observer= layout.getViewTreeObserver();
observer.addOnGlobalLayoutListener(
    new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
            public void onGlobalLayout() {
                Log.d("Log", "Height: " + layout.getHeight());
            }
        });
Say Thanks
Respond