让EditText上表现为在code一个TextView [英] Make EditText behave as a TextView in code
问题描述
如何使一个EditText看起来是在Java中,但不是在XML做一个TextView。
How to make an EditText look like a TextView that is done in Java but not in XML..
我已经看到了如何使用XML文件,像
I have seen how to do it using xml file like
style="@android:style/Widget.TextView"
android:editable="false"
android:cursorVisible="false"
android:longClickable="false"
但我想这是java的,因为我不使用的布局任何XML文件中完成.. 一切都在code本身做.. 我试图用GestureListener在我的code ..它工作得很好了TextView的,但不是的EditText 所以,任何事情做的EditText上,这样的GestureEvents可以实现?
but i want this to be done in java because i am not using any xml file for the layout.. everything is done in code itself .. I am trying to use GestureListener in my code .. it worked fine for TextView but not EditText So, anything to do for the EditText so that the GestureEvents can be implemented ?
谢谢
推荐答案
的EditText
是的TextView
的子类 - 因此除了编辑,有什么适用于的TextView
适用于的EditText
和
EditText
is a subclass of TextView
- so except for editing, what applies to TextView
applies to EditText
as well.
这篇关于让EditText上表现为在code一个TextView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!