This is the code that i used :

LinearLayout mLinearLayout;
mLinearLayout = new LinearLayout(this);

ImageView i = new ImageView(this);
    i.setImageResource(R.drawable.cow_icon);
    i.setAdjustViewBounds(true); // set the ImageView bounds to match
the Drawable's dimensions
    i.setLayoutParams(new
Gallery.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));

    //Add the ImageView to the layout and set the layout as the
content view
    mLinearLayout.addView(i);
    setContentView(mLinearLayout);


With this code, i can see the image getting didplayed but it goes on a
different layout. It doesnt display on the current layout.
Is there a way i can display this in the current layout ?


On Jul 27, 12:18 pm, Kostya Vasilyev <kmans...@gmail.com> wrote:
> You could use one image view and several different images with varying
> number of flowers.
>
> Or create the required number of image views from code, all using the same
> image.
>
> Or declare four image views in your layout and manage their visibility from
> code.
>
> --
> Kostya Vasilyev --http://kmansoft.wordpress.com
>
> 27.07.2010 21:11 пользователь "ethan" <puripun...@gmail.com> написал:
>
> Ok. So in this case, is there a way to dynamically create imageviews
> from the code (not xml) based on number of images to display ?
> Or should i just statically create 4 imageviews and only populate them
> based on the number of flowers i want to display ?
>
> On Jul 27, 10:52 am, Justin Anderson <janderson....@gmail.com> wrote:
>
> > No... displaying the number...
> > On Tue, Jul 27, 2010 at 8:25 AM, ethan <puripun...@gmail.com> wrote:
> > > You are correct.
>
> > > In...
> > > <android-beginners%252bunsubscr...@googlegroups.com<android-beginners%25252bunsubscr...@googlegroups.com>
>
> <android-beginners%25252bunsubscr...@googlegroups.com<android-beginners%2525252bunsubscr...@googlegroups.com>
>
>
>
> > > > > > > For more options, visit this group at
> > > > > > >http://groups.google.com/group/androi...

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to