Home > Net >  How can i avoid Android spellchecking my *Button*?
How can i avoid Android spellchecking my *Button*?

Time:09-29

I have a very simple button, which should look somewhat like this:

button design

However, Android sometimes decides to spellcheck it, so it looks like this:

button irl

I would like to avoid that, but i have no idea where to start? This behavior is not reproducible 100% of the time, and newer devices seem to show this error less often, or on less buttons (i'm using this style throughout my app)

Button in xml:

 <Button
    android:id="@ id/previousButton"
    style="@style/Widget.App.Button.TextButton.Link"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/parental_leave_summary_back"
    app:icon="@drawable/ic_arrow_left_small"
    app:iconGravity="textStart"
    />

Styles:

<style name="Widget.App.Button.TextButton.Link">
    <item name="android:textAppearance">@style/TextAppearance.App.12</item>
</style>

<style name="Widget.App.Button.TextButton" parent="Widget.MaterialComponents.Button.TextButton">
    <item name="android:capitalize">none</item>
    <item name="iconPadding">@dimen/distance_100</item>
    <item name="android:textAppearance">@style/TextAppearance.App.14</item>
    <item name="strokeWidth">0dp</item>
</style>

CodePudding user response:

You can do it with following code. Just paste it in layout of Button.

android:inputType="textNoSuggestions"
  • Related