问题
I am developing a chat application using Xamarin.Forms. I have a requirement of spell checking. I am using an Editor
to enter the message.
In Editor
If user types something it has to check the spelling of the word and inform the user that spelling is wrong with an underline or something(ike Grammarly does in web). How can I achieve this using Xamarin.Forms.
I have tried with Xamarin.Forms default property IsSpellCheckEnabled
but it doesn't effect anything i.e It doesn't check the spellings. Is there any workaround to achieve this. In the below image the wrong spelled word is underlined with blue color. I want to do it like this but don't have any idea on how to achieve this. Can anyone please help me with this. Thank you.
回答1:
If your Keyboard disables spell checking, IsSpellCheckEnabled
property is ignored. So try to enable spell check first from your device. For more info visit docs.microsoft. Sample code
<Editor AutoSize="TextChanges" IsSpellCheckEnabled="True" VerticalOptions="StartAndExpand"
HorizontalOptions="FillAndExpand">
</Editor>
Note: If in your keypad auto correct option in enabled, after hitting enter/space wrong spelling would correct automatic and it wouldn't show you underline text.
Update: Also set IsTextPredictionEnabled="True"
in your Editor
.
If a Keyboard has been set that disables spell checking, such as Keyboard.Chat, the IsSpellCheckEnabled property is ignored. Therefore, the property cannot be used to enable spell checking for a Keyboard that explicitly disables it.
来源:https://stackoverflow.com/questions/55037263/spell-checking-in-editor-using-xamarin-forms-application