TextView should probably be an EditText instead
TextView should probably be an EditText instead
Using a <TextView>
to input text is generally an error, you should be using <EditText>
instead. EditText
is a subclass of TextView
, and some of the editing support is provided by TextView
, so it's possible to set some input-related properties on a TextView
. However, using a TextView
along with input attributes is usually a cut & paste error. To input text you should be using <EditText>
.
This check also checks subclasses of TextView
, such as Button
and CheckBox
, since these have the same issue: they should not be used with editable attributes.
Issue id: TextViewEdits
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for Android 2023.3, Qodana for JVM 2023.3 |
Plugin: | Android, 2022.3.1 Beta 2 |
Last modified: 13 July 2023