的EditText - 如何隐藏底线 [英] edittext - how to hide underbar

查看:1483
本文介绍了的EditText - 如何隐藏底线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从code,我怎么隐藏的EditText下划线(很少有衬线在两端提示行)?

From code, how do I hide the EditText underbar (the prompt line with little serifs at the ends)?

有可能是一个更好的方式做我想做的:我有一个EditText的布局。通常情况下,这显示细腻,用户可以点击它,并开始输入或编辑文本。

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.

不过,有时我想用相同的布局(简化其他逻辑),以显示在一个只读的方式相同的数据。我想要的presentation是相似的 - 它应该具有相同的高度和相同的字体,但不具备下划线

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

作为一个权宜之计,我将通过去除的EditText而代以一个TextView来实现这一点。我认为,这将得到期望的结果,但它似乎是一个迂回的一个昂贵的方式​​做一些事情,应该是很容易做到通过改变属性。

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有一个自定义绘制,只是使绘制透明

You can just set the edittext to have a custom drawable, and just make the drawable transparent

这篇关于的EditText - 如何隐藏底线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆