Xamarin.Forms Slider iOS手势失败 [英] Xamarin.Forms Slider iOS gesture failure

查看:121
本文介绍了Xamarin.Forms Slider iOS手势失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在iOS上使用Slider时,它会滑出主"菜单.在Android上运行良好.

When I try to use the Slider on iOS it slides out the Master menu. It works fine on Android.

一个选项是一起禁用手势,但是我还没有找到一种仅针对该页面禁用手势的方法.我非常想保留其他页面的滑动手势而没有滑块.

One option would be to disable gestures all together but I haven't found a way to disable them for only that page. I would very much like to keep the sliding gestures for the other pages without sliders.

推荐答案

听起来您的滑块可能太靠近页面边缘了.如果您的设计允许,请尝试在滑块的左侧和右侧添加边距.

It sounds like your slider may be too close to edge of the page. If your design allows it, try adding a margin to the left and right of the slider.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:SliderTest"
             x:Class="SliderTest.MainPage">
   <StackLayout Orientation="Vertical" VerticalOptions="Center">
     <Slider Margin="10,0,10,0"/>
   </StackLayout>
</ContentPage>

如果您需要为iOS和Android分别设置边距,则可以这样操作:

And in case you need separate margins for iOS and Android, you can do that like this:

  <StackLayout Orientation="Vertical" VerticalOptions="Center">
    <Slider>
      <Slider.Margin>
        <OnPlatform x:TypeArguments="Thickness" iOS="10,0,10,0" Android="20,0,20,0"/>
      </Slider.Margin>
    </Slider>
  </StackLayout>

这篇关于Xamarin.Forms Slider iOS手势失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆