Note that this is a mistake from us. The flag (actually a setter
method) will be back in the next version of Android. I already made
sure of that.

Without this flag, unfortunately, you need to override ViewGroup's
drawChild()/onLayout() manually and apply the transformation yourself.

On Mon, Oct 13, 2008 at 3:42 PM, Cheryl Sedota <[EMAIL PROTECTED]> wrote:
>
> Romain,
>
> Now that the FLAG_SUPPORT_STATIC_TRANSFORMATIONS flag is gone in the
> 1.0 SDK, what do you recommend for such a scenario?
>
> Thanks,
> Cheryl
>
> On Aug 21, 10:30 am, Erik Calissendorff <[EMAIL PROTECTED]>
> wrote:
>> Thanks, that was a much easier way to modify the views at drawing.
>>
>> Some tips which I learned as I tested this approach:
>>
>> You indicate that the ViewGroup supports static transformation with:
>> this.mGroupFlags = this.mGroupFlags |
>> FLAG_SUPPORT_STATIC_TRANSFORMATIONS;
>>
>> For the modified transformation to be performed you should return true
>> from:
>> boolean getChildStaticTransformation(View child, Transformation t)
>>
>> Kindest regards,
>>
>> //Erik
>>
>> On Aug 14, 5:12 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote:
>>
>> > You need to translate the canvas to the right position for each child
>> > and take into account the scroll offsets. I highly advise against
>> > overriding dispatchDraw() because it does a number of delicate things.
>> > The next version of the SDK will make ViewGroup.drawChild() protected
>> > so that you can override dispatchDraw() more safely.
>>
>> > To move, scale and apply transparency to your Views at drawing time,
>> > it's a lot simpler than what you are doing. You can simply override
>> > the getChildStaticTransformation() method (I'm not sure of the exact
>> > name) and make sure your ViewGroup indicates it supports static
>> > transformations. Then simply return the appropriate Transformation
>> > that translates, scales and applies alpha. This is what Gallery does
>> > for instance.
>>
>> > On Thu, Aug 14, 2008 at 5:15 AM, Erik Calissendorff
>>
>> > <[EMAIL PROTECTED]> wrote:
>>
>> > > I'm trying to draw the children manually in my custom ViewGroup but
>> > > the code below only displays the left top most child. I have tried not
>> > > to clip the canvas and simply just call the child draw(Canvas c)
>> > > method directly but that results in that all children are drawn on top
>> > > of each other.
>>
>> > > What I like to accomplish is to be able to manually move,scale and
>> > > modify the transparency of theViewat each draw call from the parent.
>>
>> > > I hope that someone can inform me how to make this work.
>>
>> > > Below is a my onLayout and dispatchDraw functions as they are now.
>>
>> > >        @Override
>> > >        protected void onLayout(boolean changed, int l, int t, int r, int 
>> > > b)
>> > > {
>> > >                for(int i=0;i<this.getChildCount();i++)
>> > >                {
>> > >                        Viewchild = this.getChildAt(i);
>> > >                        Rectrect=this.mCellPositions[i];
>> > >                        
>> > > child.layout(rect.left,rect.top,rect.right,rect.bottom);
>> > >                }
>> > >        }
>>
>> > >        @Override
>> > >        protected void dispatchDraw(Canvas canvas) {
>> > >                for(int i=0;i<this.getChildCount();i++)
>> > >                {
>> > >                        Viewview= this.getChildAt(i);
>> > >                        Rectcell=this.mCellPositions[i];
>> > >                        canvas.save();
>> > >                        if(canvas.clipRect(cell,Op.REPLACE))
>> > >                        {
>> > >                                
>> > > if(!canvas.quickReject(view.getLeft(),view.getTop(),
>> > >view.getRight(),view.getBottom(), EdgeType.BW))
>> > >                                {
>> > >                                        view.draw(canvas);
>> > >                                }
>> > >                        }
>> > >                        canvas.restore();
>> > >                }
>> > >        }
>>
>> > --
>> > Romain Guywww.curious-creature.org
>>
>>
> >
>



-- 
Romain Guy
www.curious-creature.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
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