InputTransparent = true在Xamarin Forms Android中不起作用

InputTransparent = true在Xamarin Forms Android中不起作用,第1张

概述从 this链接. false if the element should receive input; true if element should not receive input and should, instead, pass inputs to the element below. Default is false. 我想要的是,不允许Entry字段接收来自用户的输入. InputT 从 this链接.

false if the element should receive input; true if element should not receive input and should,instead,pass inputs to the element below. Default is false.

我想要的是,不允许Entry字段接收来自用户的输入.

inputtransparent = true在iOS中运行良好但在AndroID中不起作用,它仍然允许用户提供输入.

我尝试过IsEnabled = false,但这会改变我的Entry字段的外观,我不希望这样.

这是某种错误吗?

解决方法 inputtransparent不适用于AndroID.我为StackLayout创建了简单的渲染:

在PCL项目中:

public class StackLayoutAdd :StackLayout{}

在AndroID项目中:

[assembly: ExportRenderer(typeof(StackLayoutAdd),typeof(StackLayoutAddCustom))] .....public class StackLayoutAddCustom : VisualElementRenderer<StackLayout>{    public overrIDe bool dispatchtouchEvent(MotionEvent e)    {        base.dispatchtouchEvent(e);        return !Element.inputtransparent;    }}

我在我的xaml中使用它:

<StackLayoutAddCustom inputtransparent={Binding IsReadonly}>   <Editor />  .... </StackLayoutAddCustom>

这是儿童控制的工作.

总结

以上是内存溢出为你收集整理的InputTransparent = true在Xamarin Forms Android中不起作用全部内容,希望文章能够帮你解决InputTransparent = true在Xamarin Forms Android中不起作用所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1135672.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存