AbsoluteLayout can be replaced by RelativeLayout.

Use android:layout_marginLeft and android:layout_marginTop in the child view to position it.

-- Kostya

PS - Why they got rid of AbsoluteLayout is a mystery. It's possible to use device-independent units with it (good) and to misuse other layout classes by specifying sizes and positions in absolute pixels ("px" in XML). Oh well.

John Gaby <jg...@gabysoft.com> писал(а) в своём письме Wed, 05 May 2010 20:14:34 +0400:

Thanks for the response.  I want to be able to set both the size and
position of the child view.  It seems like in order to do that I would
need to use AbsoluteLayout which is deprecated.  How can I have
complete control over the size and position of my child windows?  Do I
need to create my own layout class?

Thanks

On May 5, 8:42 am, social hub <shubem...@gmail.com> wrote:
You basically need a context to create and possibly a layout to add

TextView tv = new TextView(mContext);//context can be an activity or u can
use getBaseContext();
tv.setLayoutParams(new LayoutParams(50,60));//set some height and width and
it can be wrap_content or fill_parent
tv.setText("hello Android");

layout.add(tv);//this can be any layout if you have linearlayout in ur xml
file then
                     //find it by LinearLayout
layout=(LinearLayout)findViewById(R.id.main);

You can do this in onclick event or a menu event upto you.

This should work in general , you can play around with it.



On Wed, May 5, 2010 at 10:26 AM, John Gaby <jg...@gabysoft.com> wrote:
> I am new to Android development.  I would like to be able to add child
> views (e.g. buttons, text, etc.) to my main view at runtime, and to be
> able to position and size those views dynamically.  I cannot figure
> out exactly how to do that.  Can anyone point me in the right
> direction?

> Thanks

> --
> 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<android-developers%2bunsubscr...@googlegroups.com>
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group athttp://groups.google.com/group/android-developers?hl=en



--
Kostya Vasilyev - WiFi Manager + pretty widget - http://kmansoft.wordpress.com/sw

--
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