简体   繁体   中英

How to set AbsoluteLayout.LayoutBounds by platform?

I'm using an absolute layout in my application and I want, for each element in the layout, a specific position and size depending the platform.

I find an other question where it was said that to use

<Label.AbsoluteLayout.LayoutBounds>

But it my case, the AbsoluteLayout property doesn't exist if I write it between <...>

So, It is possible to set the property LayoutBounds by platform?

I'm using Xamarin 4.4.

Thanks for your help

AbsoluteLayout.LayoutBounds="{OnPlatform Android='0,0,1,1', iOS='0,0,.5,.5'}"

I believe that should work, but i haven't tested it. You just need to use OnPlatform and provide the desired values for each platform you want to cover.

Edit: Just tested this. It works.

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