简体   繁体   中英

Xamarin forms, change absolutelayout with an animation

How can I implement a for example "Easing.Linear"-animation while the size of my label that is controlled with an AbsoluteLayout increases in size?

Right now If I do for example like this:

AbsoluteLayout.SetLayoutBounds (myLabel, new Rectangle (0f, 0f, 1f, 1f)); 

The label indeed increases but It happens immediately. I would like to add an animation to it while it increases.

Any ideas how I can get this done?

UPDATE: Made a bit of progress but the label now gets smaller and flies away topleft. No idea why it is happening because I am increasing the size with my new rectangle, not decreasing.

await myLabel.LayoutTo(new Rectangle (0.5, 0.4, 1.0, 0.6), 1000, Easing.Linear);

In my XAML I use this to my Label:

AbsoluteLayout.LayoutBounds="0.25, 0.25, 0.5, 0.5" AbsoluteLayout.LayoutFlags="All"

LayoutTo method is pixel oriented, not proportional, so you need to give actual values instead of rates.

ie: await myLabel.LayoutTo(0.5*Width,0.4*Height,myLabel.Width,myLabel.Height);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM