Hi Matthieu,

I had a similar problem to what you describe, but using a custom
component.
I fixed this by modifying its onLayout() method.

Originally, i just called the component children's layout method :

protected void onLayout(boolean changed, int l, int t, int r, int b){
        mCount = this.getChildCount();
        for(int i = 0 ; i < mCount ; i++){
                getChildAt(i).layout(160 - 180/2, 190 - 180/2, 160 + 180/2, 190
+ 180/2) ;
        }
}

After I put the children into LinearLayouts, i had to call explicitly
the children's children's layout method :

protected void onLayout(boolean changed, int l, int t, int r, int b){
        mCount = this.getChildCount();
        for(int i = 0 ; i < mCount ; i++){

                ( (ViewGroup)getChildAt(i) ).getChildAt(0).layout(0, 0, 180,
180 ) ;
                ( (ViewGroup)getChildAt(i) ).getChildAt(1).layout(0, 0, 180,
180 ) ;

                getChildAt(i).layout(160 - 180/2, 190 - 180/2, 160 + 180/2, 190
+ 180/2) ;
        }
}

However, the view's animation looks a bit ugly now, there may be a
better fix.
Anyway, i hope it's still useful for you or anyone.

jean-louis


On Aug 31, 8:11 am, Matthieu Jeanson <[email protected]>
wrote:
> Hi,
>
> Probably something really easy, but I am missing it and have been banging my
> head for a while now.
>
> I created my own layout to partition the whole screen into a grid, so far so
> good -- using nested LinearLayout of a TableLayout was getting a bit messy
> for something really simple --
> I can put buttons, textviews in every cell and it works just fine.
> Now, when I add a LinearLayout in one of the cell, no child of that layout
> gets drawn on the screen.
>
> When I check with the hierarchy viewer, it tells me the sizes of the
> children is all 0 (height and width). It does not matter really what I have
> for layout_width and layout_height.
>
> For my GridLayout, I follows the same as FrameLayout by extending ViewGroup
> and override onMeasure (return the minimum between the size of the parent
> and the size of the screen) and onLayout.
>
> Any idea ?
>
> Thanks,
> Matthieu

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to