In my a LinearLayout I have set android:layout_marginBottom
in my XML. I just want to retrieve that value.
Just LayoutParams
doesn't give me access to bottomMargin
. I tried to typecast :
row1 = (LinearLayout) findViewById(R.id.mainrow1);
LinearLayout.LayoutParams row1Params = (android.widget.LinearLayout.LayoutParams) row1.getLayoutParams();
but this gives me Runtime exception ClassCastException.
The main aim is I got buttons in nested LinearLayouts & I want to set height/width of LinearLayout programmatically that will inturn auto set height of buttons. I have added bottomMargin after 1st layout - so there is space between 2 rows.