In Android activity .... how to do the following using only code instead of XML?
<TextView android:background="#0000ff" android:layout_margin="2dip"/>
I also need text alignment ...
stuck on it for a while = ((if someone could help
thank
UPDATE
I tried the code below
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.FILL_PARENT,
RelativeLayout.LayoutParams.FILL_PARENT);
lp.setMargins(5,5,5,5);
and i did
row.addView(t1, lp);
row.addView(t2);
row.addView(t3);
row.addView(t4);
I also tried LinearLayout
but t1 for some reason is no longer displayed ....
source
share