How to hide underbar in EditText

How can I hide the EditText underbar (the prompt line with little serifs at the ends)?

There might be a better way to do what I want: I have a layout with an EditText. Normally, this displays fine where the user can tap on it and begin entering or editing text.

Sometimes, however, I would like to use the same layout (simplifies other logic) to display the same data in a read-only manner. I want the presentation to be similar - it should have the same height and same font, but not have the underbar.

As a stop-gap measure, I'm going to implement this by removing the EditText and substituting a TextView. I think that will give the desired results, but it seems like a roundabout an expensive way to do something that ought to be easy to do by changing attributes.


您可以将EditText设置为具有自定义透明可绘制或仅使用android:background="@android:color/transparent"


将背景设置为null。

android:background="@null"

Please set your edittext background as

android:background="#00000000"

It will work.

链接地址: http://www.djcxy.com/p/92994.html

上一篇: 活动开始时如何隐藏软键盘

下一篇: 如何在EditText中隐藏下划线