Can I set "android:layout_below" at runtime, programmatically? -


Is it possible to set the relative layout on runtime to set the value of android: layout_below ? Programmically?

Yes:

  Relative layout. LayoutParam P = New Relative Layout. Outout (View Group LayoutParms. WRAP_CONTENT, View Group, LayoutParmsWRAP_CONTENT); P.ADRule (relative layout. Below, R.id.below_id); ViewToLayout.setLayoutParams (P);  

Firstly specifies the code height and width creates a new layout parameter. The addRule method combines equivalent of xml propery android: layout_below . Then you just call see # setoutparam to call those columns


Comments