Aka*_*min 7 xamarin.ios xamarin.android xamarin
从这个链接.
如果元素应该接收输入,则为false; 如果元素不应该接收输入,则应该为true,而应将输入传递给下面的元素.默认值为false.
我想要的是,不允许Entry字段接收来自用户的输入.
InputTransparent=true 在iOS中运行良好但在Android中不起作用,它仍然允许用户提供输入.
我试过IsEnabled=false但是这改变了我的Entry字段的外观,我不希望这样.
这是某种错误吗?
InputTransparent 不适用于 Android。我为 StackLayout 创建了简单的渲染:
在PCL项目中:
public class StackLayoutAdd :StackLayout
{
}
Run Code Online (Sandbox Code Playgroud)
在Android项目中:
[assembly: ExportRenderer(typeof(StackLayoutAdd), typeof(StackLayoutAddCustom))]
.....
public class StackLayoutAddCustom : VisualElementRenderer<StackLayout>
{
public override bool DispatchTouchEvent(MotionEvent e)
{
base.DispatchTouchEvent(e);
return !Element.InputTransparent;
}
}
Run Code Online (Sandbox Code Playgroud)
我在我的 xaml 中使用它:
<StackLayoutAddCustom InputTransparent={Binding IsReadOnly}>
<Editor />
....
</StackLayoutAddCustom>
Run Code Online (Sandbox Code Playgroud)
这是儿童控制的工作。
| 归档时间: |
|
| 查看次数: |
1243 次 |
| 最近记录: |