Java Question LinearLayout

stefanobusetto

Active Member
Licensed User
Longtime User
is there any sample to create a wrapper from scratch?
like the one of the scrollview you posted.
tanks
 

stefanobusetto

Active Member
Licensed User
Longtime User
here is it!

i wrapped an HorizontalScrollView and created inside a layout
i've not been able to create the layout inside the innerInitialize
because i'was not able to get the width and height of the scrollview
so first i initialize then i create then layout

@ShortName("xnGrid")
public class xnGrid extends ViewWrapper<HorizontalScrollView>
{ ...

public void innerInitialize ( final BA ba, final String eventName, boolean keepOldObject )
{ hsv = new HorizontalScrollView ( ba.context ) ;
setObject ( hsv ) ;
...
}

public void CreateLayout ( ... )
{ pnl = new LinearLayout ( hsv.getContext() ) ;
pnl.setOrientation ( LinearLayout.VERTICAL ) ;
hsv.addView ( pnl , w , h ) ;
...
}

hope it helps
should you have any questions
:)
 

thedesolatesoul

Expert
Licensed User
Longtime User
Thank you.
Of course I have loads of questions :)
1/ What does setObject(hsv) do?
2/ Do you have to give hsv context to the linear layout? i.e. you need to give whatever the parent of the linearlayout will be?

So I see you set the linear layout to the width and height and later on add more views into it.
As I want it to be a repeating pattern, I will need a nested linear layout.
I think I am starting to understand.
 

stefanobusetto

Active Member
Licensed User
Longtime User
Layouts

1) I'm not sure. There is no documentation about it.
I think you have to tell the wrapper which is the view you have created.
I have created a wrapper of a scroll view.
So, to begin with, i create the scrollview (hsv) how i like it.
And after i tell the wrapper this is the scrollview.

2) I've created an horizontal scroll view
which contains a table layout
which contains several table rows
each containing text views.

The context (ba.context) is the same for all the views ( table layout, rows, ... ).

Then you add ( i mean addView )
a) the table layout to the scroll view
b) each table row to the table layout
c) each text view to the proper table row

I'm trying to figure out a simpler layout.
Using a relative layout.

I hope I have been clear.
:)
 
Top