|
<inputLayout:SfTextInputLayout Hint="Entry" ContainerType="Outlined" x:Name="inputlayout">
<Entry>
<Entry.Effects>
<effects:NoKeyboardEffect/>
</Entry.Effects>
</Entry>
</inputLayout:SfTextInputLayout> |
|
public class NoKeyboardEffect : RoutingEffect
{
public NoKeyboardEffect() : base("ControlSamples.Effects.NoKeyboardEffect")
{
}
} |
|
[assembly: ExportEffect(typeof(NoKeyboardEffect_Droid), nameof(NoKeyboardEffect))]
namespace ControlSamples.Droid.Effects
{
public class NoKeyboardEffect_Droid : PlatformEffect
{
protected override void OnAttached()
{
try
{
if (Control is EditText editText)
{
// cursor shown, but keyboard will not be displayed
if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop)
{
editText.ShowSoftInputOnFocus = false;
}
else
{
editText.SetTextIsSelectable(true);
}
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"{nameof(NoKeyboardEffect_Droid)} failed to attached: {ex.Message}");
}
}
protected override void OnDetached()
{
}
}
} |
|
[assembly: ExportEffect(typeof(NoKeyboardEffect_iOS), nameof(NoKeyboardEffect))]
namespace ControlSamples.iOS.Effects
{
public class NoKeyboardEffect_iOS : PlatformEffect
{
protected override void OnAttached()
{
try
{
if (Control is UITextField textField)
{
// dummy view to override the soft keyboard
textField.InputView = new UIView();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"{nameof(NoKeyboardEffect)} failed to attached: {ex.Message}");
}
}
protected override void OnDetached()
{
}
}
} |
Hi,
I have tested the code with Android 4.4.2 and it´s not working (keyboard AOSP). Please could you tell me if it´s possible to fit it to this case?
Thanks in advance!