如何以Xamarin形式使图标大小在景观模式和Potrait模式下相同



我是xamarin.forms中的初学者。我正在使用Xamarin.Forms绝对布局来识别消息数。在Potrait模式下,它可以正常工作。在景观模式下,它给出了扩大图标。有什么办法可以改变这一点?请建议。

这是我的XAML文件:

<effect:BudocodeButton x:Name="chatMsgCnt" AbsoluteLayout.LayoutBounds=".9,0,.4,.9" BorderRadius="12" 
                                           AbsoluteLayout.LayoutFlags="PositionProportional,SizeProportional" BackgroundColor="Red" TextColor="White" FontSize="Medium" Text="{Binding ChatMsgCount}" FontAttributes="Bold" >

landscapeimg

potraitimage

使您的高点和视图的宽度静态,并设置 absolutelayout.layoutflags to x&amp; y比例。

代码:

<effect:BudocodeButton 
 x:Name="chatMsgCnt" 
 AbsoluteLayout.LayoutBounds=".9,0,60,60"
 BorderRadius="12" 
 AbsoluteLayout.LayoutFlags="XProportional,YProportional"
 BackgroundColor="Red" 
 TextColor="White" 
 FontSize="Medium" 
 Text="{Binding ChatMsgCount}" 
 FontAttributes="Bold">

最新更新