I have seen many questions regarding removing of underline for autolink of textview.
But for me, I am unable to remove underline for normal textview. I set the underline by:
textview.setPaintFlags(nameOnTemplateTextview.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
So, in Gboard settings - go to settings, language & input then note that Gboard has to be set as the spell checker for the system. So switch ON spell check to select Gboard, then switch off spell check in Gboard settings (and not system which remains on).
Originally Answered: How do I remove the underline feature while typing in Android keyboard ? Goto settings > Language & input > Android Keyboard settings > auto correction > off.
On your keyboard, press and hold the left or right Shift key and then press the End key to highlight the entire line. Press the Delete key to delete the line of text.
You can try
textview.setPaintFlags(textview.getPaintFlags() & (~ Paint.UNDERLINE_TEXT_FLAG));
or more broadly just set,
textview.setPaintFlags(0)
but the first option is more exact
Here is technique you can try to remove underline from any textview or edit text using the given below example code snippet
<TextView
android:id="@+id/et"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginBottom="10dp"
android:hint="This is first EditText"
android:fontFamily="sans-serif-light"
android:background="@null"
/>
Use of the attribute
android:background="@null"
you can remove underline from textview or edit text
You can also try putting transparent color to the background to remove underline beneath a textview.
Maybe it's too late to answer this good question but I share my experience; perhaps it might be helpful for some one.
There is a really practical and easy way to remove underline for a text. And that is: textview.setPaintFlags(View.INVISIBLE);
It works perfect for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With