PDA

View Full Version : about some components in a container



cabe
17 Feb 2009, 12:33 AM
Maybe it is very simple to render a child component into a container,but how about render lots of child components into a container? My trouble is that the size of one child component is 50*50,and the container's size is 500*500,so it can contain 100 child components((500*500)/(50*50)=100) but I can't find a qualified layout for the container to realize it. :-/ If there is no way to use layout,how can I do it ?
regards!

sdc
17 Feb 2009, 2:53 AM
I'm not sure, but FlowLayout won't just do the job ?

cabe
17 Feb 2009, 5:32 AM
No,FlowLayout wont't work,you will see 10 child components in a sigle row and the other 90 in the row are out of the container's border where you can' see them.Most room of the container are blank. Just like this :
--------------
a -
a -
a -
a -
--------------
and I want to be like this :
---------------
aaaaaaaaaaaa-
aaaaaaaaaaaa-
aaaaaaaaaaaa-
aaaaaaaaaaaa-
--------------

sven
17 Feb 2009, 5:35 AM
Write your own layout to fit this needs. It is quite simple to do so.

sdc
17 Feb 2009, 5:41 AM
Use a TableLayout with 10 columns ?

cabe
17 Feb 2009, 7:31 PM
thank you sdc, your suggestion give me some clues,but if I use TableLayout with 10 columns,
the position of the child component is not fit my needs.Because the order of rendering components is not fit.For example I have 10 components (a1,a2,a3,a4,a5,a6,a7,a8,a9,aa)need to be rendered into a container,the TableLayout with 5 columns will do like this:
---------------
a1 a2 a3 a4 a5-
a6 a7 a8 a9 aa-
---------------
I want this:
------
a1 a6-
a2 a7-
a3 a8-
a4 a9-
a5 aa-
------
and if use TableLayout with 2 column it will be this:
------
a1 a2-
a3 a4-
a5 a6-
a7 a8-
a9 aa-
------
not exact I want.

If I have to write my own layout,it is really a tough job for me:s,(can sven give me some helping codes to do this?)
Now I just go to read TableLayout API hoping to find more clues.