Get Height of LinearLayout or RelativeLayout in Android programmatically -


i need length of linearlayout or relativelayout programmatically in android if have linearlayout follows

<relativelayout         android:layout_width="match_parent"         android:layout_height="wrap_content" >  

i need increase height of layout located in mid of screen taking screen height , increase or decrease height taking calculations on basis of screen height. there way of calculating height of layout height set wrap_content. tried height layout parameters gives me value of -1 or -2 not height in pixels or density pixels.

try following:

mylayoutref.post(new runnable() {     int height = mylayoutref.getheight; }); 

this runnable runs after layout has been drawn , laid out on screen, height returns real height , not 0


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -