image - Xamarin Forms如何水平填充图像视图并垂直扩展?
问题描述
我在固定ImageButton的宽度时遇到问题,并且高度将随着我在 ImageButton 中使用的图像大小而改变,我在Scrollview中多次使用ImageButton,我使用Visual Studio创建一个跨平台使用Xamarin的应用程序,所以我用来解决我的问题的方法在这里和这里,但我无法使用任何东西来解决它,这是一张描述我想要的图片:-
如果我的问题有答案,请不要重复,因为我是Xamarin Forms的新手,而且我没有找到任何完全符合我的问题的答案,这是我的代码:-
<Frame CornerRadius="10" OutlineColor="#fce9cc" Padding="4" Margin="15" VerticalOptions="StartAndExpand"
HasShadow="True" x:Name="ViewLayout" x:FieldModifier="public" BackgroundColor="Black">
<StackLayout>
<Label x:Name="filmNameLabel_1" HorizontalOptions="Center" FontSize="Large" TextColor="White"
Margin="0,15,0,15"/>
<StackLayout Orientation="Vertical">
<ImageButton x:Name="imageWidget_1" BackgroundColor="Black" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Aspect="AspectFill"/>
</StackLayout>
</StackLayout>
</Frame>
第一次我将StackLayout或ImageButton的 HeightRequest 的父级设置为一个数字,它会使ImageButton的高度成为一个固定数字,但我不希望ImageButton的高度随着图像的大小比而改变再见固定在父布局旁边的宽度。
解决方案
推荐阅读
- c# - 如何从 Azure Functions 中进行 Web 服务调用(对认知服务)?
- windows - 符号链接名称中包含单词的所有目录(Windows Batch)
- java - 如何在春季卡夫卡消费者消费之前过滤卡夫卡消息
- typescript - 带有 Chrome 调试器扩展的 Visual Studio Code 中的“未验证断点”
- c# - 在运行时在 TreeView 上添加子节点
- reactjs - Material ui v1 默认主题未定义
- ios - 如何获取我的 iOS 应用程序的根目录?
- python - 无法删除具有特定单元格值的行 python openpyxl
- python-3.x - 使用代理 Lambda 集成获取引用域/url
- java - json 满“\”