0
我有一個網格,其中包含一個動態數量的控件,並且每個控件都有它自己的點擊事件。我需要能夠捏在這個網格添加或刪除列。在iOS上,這很好地工作。但是,在Android上,捏合手勢,只有當它在屏幕的一個區域的完成那裏有沒有控制工作。如果我試圖捏住任何控件,什麼都不會發生。我添加了一些調試語句,看起來並不是捏事件甚至被解僱。它幾乎看起來好像控制器正在吞嚥手指並且不允許捏開火。相關的代碼在下面發佈('xxxx是我必須修改一些代碼的地方)。Xamarin形式的捏手勢在定位在另一個控件上時無法在Android上工作
的XAML:
<ContentPage x:Class="xxxxx"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<Grid RowSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<xxxxxx x:Name="xxxxx" Grid.Row="0" />
<ScrollView Grid.Row="1">
<Grid x:Name="ContentGrid"
ColumnSpacing="4"
RowSpacing="4"/>
</ScrollView>
</Grid>
</ContentPage>
構造函數:
private PinchGestureRecognizer pinch;
public xxxxx()
{
InitializeComponent();
pinch = new PinchGestureRecognizer();
pinch.PinchUpdated += Zoom;
ContentGrid.GestureRecognizers.Add(pinch);
}
網格填充(我不得不削減下來只有相關部分):
var tapGesture = new TapGestureRecognizer();
tapGesture.Tapped += OnCtrlTapped;
ctrl.GestureRecognizers.Add(tapGesture);
ContentGrid.Children.Add(ctrl, colIndex, rowIndex);
我沒有包含Zoom方法,因爲它在啓動時可以正常工作。上面提到的問題是,當控件發生夾傷時不會觸發。我是否遇到了一個我不知道的錯誤,或者我是否做了一些事情來引起衝突?