I have the a LinearLayout
with width set in xml as fill_parent
, now i need its width at runtime programatically. So i did this:
LinearLayout layoutGet=(LinearLayout) findViewById(R.id.GameField1);
LayoutParams layParamsGet= layoutGet.getLayoutParams();
int width=layParamsGet.width;
But width
value on debugging was found to be -1
, anybody with idea why can't i get the exact width at runtime for LinearLayout with fill_parent set in layout xml.