addView() is what you're looking for.

On Mar 9, 2:51 pm, Lucius Fox <lucius.fo...@gmail.com> wrote:
> Fromhttp://d.android.com/guide/topics/ui/declaring-layout.html, it said
> "Instantiate layout elements at runtime. Your application can create
> View and ViewGroup objects (and manipulate their properties)
> programmatically."
>
> Can you please tell me how/where I can find example for that?
>
> For example, how can I convert the following layout into Java code of
> my MyWidget. So that when I put "<MyWidget...>" in my layout xml file,
> it will automatically build a Gallery inside the MyWidget?
>
>  <MyWidget android:id="@android:id/wigetId"
>             android:layout_width="fill_parent"
>             android:layout_height="wrap_content">
>
>                 <LinearLayout
>     android:orientation="vertical"
>     android:layout_width="fill_parent"
>     android:layout_height="fill_parent">
>
>         <com.mycompany.widget.MyGallery android:id="@+id/gallery"
>         android:layout_width="fill_parent"
>         android:layout_height="wrap_content"
>         />
>
>         </LinearLayout>
>
>         </MyWidget>
--~--~---------~--~----~------------~-------~--~----~
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