Tuesday, December 22, 2009

Re: [android-developers] Re: Is it ever OK to use AbsoluteLayout?

On Mon, Dec 21, 2009 at 8:27 PM, k_day <kevin.r.day@gmail.com> wrote:
> Yeah, I would like to do that.  What sort of View would I parent off
> of though?  AbsoluteLayout is the only type of layout that I can find
> that will allow me to assign coordinates to.

Margins on children of a RelativeLayout behave very much like coordinates.

RelativeLayout layout = new RelativeLayout();
ImageView iv = new ImageView( getBaseContext() );

[...]

MarginLayoutParams mlp = new MarginLayoutParams( width, height );
mlp.setMargins( left, 0, 0, 0 );
LayoutParams lp = new LayoutParams( mlp );
layout.addView( iv, lp );


--
Greg Donald
http://destiney.com/

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate