ios - Xamarin 在 iOS 中形成图像大小
问题描述
我在调整 iOS 设备中的图像大小时遇到了困难。我在 iOS 项目的 Resource 文件夹中放置了 3 张图片(forest.png、forest@2x、forest@3x)。使用不同的 iOS 设备,图像以相同大小显示
<Image Aspect="AspectFit" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" Source="forest"/>
我做错了什么,或者需要修改什么?提前致谢
解决方案
这应该是预期的行为,因为screen resolution/image size
比率将相同。
如果要在所有屏幕上放置具有相同百分比面积的图像,请使用AbsoulteLayout
或Grid
放置。
即(放置一个使用 60% 屏幕的图像):
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Row="1" Grid.Column="1" Source="Forest" Acpect="AspectFit"/>
</Grid>
推荐阅读
- python - IndexError:python拆分函数的列表索引超出范围错误
- javascript - React .env.environment 文件的变量不起作用
- php - Laravel 可搜索属于
- python - 如何将className添加到body标签
- python - 如何在不使用谷歌表格的情况下使用 python 更新谷歌驱动器中的现有 csv
- serverless-framework - react.js 代码中的控制台应用程序参数是否在 serverless.yaml 之外?
- javascript - 将对象属性传递给函数
- python - 用与下一列对应的颜色填充 nan 值
- amazon-web-services - 前端和后端如何部署同一个域名?
- reactjs - isAuthenticated 是未定义的反应js吗?