Hi ,
If the position of the Activity has to be changed at runtime then we need to
get the Window Object from the Activity and then set the x, and y
coordinates of the Layoutparams.
Below is the snippet from the code which worked out for me.

WindowManager.LayoutParams lp = *this*.getWindow().getAttributes();
lp.x = 50;  //x position on the screen
lp.y = 50;
*this*.getWindow().setAttributes(lp);

Hope, this is helpful.

On Wed, Jan 27, 2010 at 10:05 PM, ls02 <[email protected]> wrote:

> In activity onCreate where all views are set all views sizes are still
> 0. I need to create an image that depends on sizes on some views.
> These views sizes depend on content set at runtime. I didn't find any
> overridable in activity that is called AFTER all views have been set
> and inflated and their inflated runtime sizes are valid.
>
> On Jan 27, 10:48 am, "Mark Murphy" <[email protected]> wrote:
>  > > How do I reposition views at runtime?
> >
> > The same way you position them in the first place -- by manipulating
> their
> > layout rules (e.g., android:layout_centerInParent). You do this via
> > calling getLayoutParams() on your View, casting it to an appropriate type
> > (e.g., RelativeLayout.LayoutParams), making the desired changes, and
> > calling setLayoutParams() to affect those changes.
> >
> > Note that I haven't done this in quite some time, so the above recipe is
> > from memory and may be a bit off, though I'm pretty sure it is mostly
> > correct.
> >
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com
> > Android App Developer Books:http://commonsware.com/books.html
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

Reply via email to