小编Jyo*_*ash的帖子

Xamarin Form 中的 PinchGesture 像 Instagram 移动提要屏幕一样缩放

我正在尝试在 xamarin 跨平台应用程序中实现类似的缩放功能,例如 Instagram 移动应用程序提要屏幕。实际上我想ImageViewListView单元格内部添加捏合手势,如果用户捏合图像,它应该放大ListView。一旦用户松开捏它应该自动调整到原始大小并适合单元格。
帮助我并提供解决方案。

以下示例代码工作但它在单元格内缩放,它不像 Instagram 缩放重叠/叠加效果。

XAML 代码

<ListView x:Name="listView" ItemSelected="PlayerList_OnItemSelected"  HasUnevenRows="false" RowHeight="300" BackgroundColor="#F6F3F6" 
RelativeLayout.XConstraint=
"{ConstraintExpression Type=RelativeToParent,
Property=Width, Factor=0}" 

RelativeLayout.YConstraint=
"{ConstraintExpression Type=RelativeToParent,
Property=Height, Factor=.09}"

RelativeLayout.HeightConstraint=
"{ConstraintExpression Type=RelativeToParent,
Property=Height, Factor=.91}"

RelativeLayout.WidthConstraint=
"{ConstraintExpression Type=RelativeToParent,
Property=Width, Factor=1}">
<ListView.ItemTemplate>
    <DataTemplate>
<ViewCell >
<Frame Margin="5" Padding="5"  OutlineColor="White" HasShadow="true">

<RelativeLayout >
<Label Font="Bold,20" Text="{Binding name}" TextColor="Black"
        RelativeLayout.YConstraint="{ConstraintExpression 
        Type=RelativeToParent,
        Property=Height,
        Factor=.0}"
        RelativeLayout.XConstraint="{ConstraintExpression 
        Type=RelativeToParent, 
        Property=Width, 
        Factor=.02}"
        RelativeLayout.WidthConstraint="{ConstraintExpression 
        Type=RelativeToParent, 
        Property=Width,
        Factor=.9}"/>

    <local:PinchToZoomContainer RelativeLayout.WidthConstraint="{ConstraintExpression
        Type=RelativeToParent,
        Property=Width, 
        Factor=1}"
        RelativeLayout.XConstraint="{ConstraintExpression
        Type=RelativeToParent,
        Property=Width, 
        Factor=0}" …
Run Code Online (Sandbox Code Playgroud)

c# zooming pinch xamarin xamarin.forms

5
推荐指数
0
解决办法
411
查看次数

标签 统计

c# ×1

pinch ×1

xamarin ×1

xamarin.forms ×1

zooming ×1