dynamically filling a layout

0 views
Skip to first unread message

sahir contractor

unread,
Feb 5, 2011, 7:43:51 PM2/5/11
to Purdue Android Programming
hi,
im trying to create a scrollable view within a row of a table view and
this scrollable view should be populated by images from a server. i
have the code to download images from a server but can't figure out
how to fill the scrollable view on the fly . any help would be
appreciated.
thanks,
Sahir.

Jaye Franklin

unread,
Feb 5, 2011, 7:49:25 PM2/5/11
to purdue-androi...@googlegroups.com
If you already know the size of the images and how many images are going to be in your scrollable view you can, hardcode the ImageView's into your screen and populate them once you have download your images.
--

-John Franklin Jr.

Rodrigo Haragutchi

unread,
Feb 6, 2011, 10:05:21 AM2/6/11
to purdue-androi...@googlegroups.com

You can also add imageviews dynamically in the Java code. Scrollviews can only have one child, so you would first add a linear or relative layout as the scrollview's child. Then in the Java code, bind that layout to an object using findViewById, create a new ImageView, and use the addView method from the layout object.

sahir contractor

unread,
Feb 6, 2011, 5:27:36 PM2/6/11
to Purdue Android Programming
alright, i didnt know you could dynamically set up layouts... i
thought you had to have the xml file ready to go ... i think ive got
some ideas on how to do it...
thanks for the fast answers guys !

Rodrigo Haragutchi

unread,
Feb 6, 2011, 5:45:53 PM2/6/11
to purdue-androi...@googlegroups.com
you're welcome, good luck!
--
Rodrigo Haragutchi
Purdue ACM SigApp President
Google Student Ambassador

Reply all
Reply to author
Forward
0 new messages