Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
462 views
in Technique[技术] by (71.8m points)

How to remove the underline from the EditText field in Android?

Whenever a word is typed in the EditText box, I always see an underline under the word being typed. But when I press a space after that word I no longer see the underline.

My reqirement is to remove that underline when the user is typing the message.

Added is the screenshot and we see that Smith is underlined. But I don't want this to happen.

Below is the xml that I use for the AlertDialog box.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView 
    android:id="@+id/name_view"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:layout_marginLeft="20dip"
    android:layout_marginRight="20dip"
    android:text="@string/alert_dialog_name"
    android:gravity="left"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<EditText
    android:id="@+id/username_edit"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:layout_marginLeft="20dip"
    android:layout_marginRight="20dip"
    android:scrollHorizontally="true"
    android:autoText="false"
    android:inputType="textPersonName"
    android:capitalize="none"
    android:gravity="fill_horizontal"
    android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>

enter image description here

question from:https://stackoverflow.com/questions/5504433/how-to-remove-the-underline-from-the-edittext-field-in-android

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

android:inputType="textNoSuggestions"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...