Hi Jagat,

Use setMargins() in the LayoutParams, use
android.widget.LinearLayout.LayoutParams. Dont use this class,
android.view.ViewGroup.LayoutParams; I use latter one and blown away
my time. In the latter one, setMargins() is not there. I dont want
anybody else to do the same.

Use any layout, but from widget package.

params.setMargins();
layout.addView(view, params);

Hope this will help you.

Thanks

On Nov 25, 2:05 pm, Jags <jag...@gmail.com> wrote:
> I have an array of buttons. I need to change their
> android:layout_marginLeft programmatically. This is essential to my
> logic, without which I am unable to get my layout correct. Any code
> snippets representing this is appreciated pretty much.
>
> //                      ViewGroup.MarginLayoutParams lp = new 
> ViewGroup.MarginLayoutParams
> (30, 5);
> //                      arrBtns[i].setLayoutParams(lp);
>
> this crashes the code
> any pther approach ?
>
> regards
> Jagat

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to