(#) TextView should probably be an EditText instead
!!! WARNING: TextView should probably be an EditText instead
This is a warning.
Id
: `TextViewEdits`
Summary
: TextView should probably be an EditText instead
Severity
: Warning
Category
: Correctness
Platform
: Android
Vendor
: Android Open Source Project
Feedback
: https://issuetracker.google.com/issues/new?component=192708
Since
: Initial
Affects
: Resource files
Editing
: This check runs on the fly in the IDE editor
Implementation
: [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/TextViewDetector.java)
Tests
: [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/TextViewDetectorTest.java)
Copyright Year
: 2012
Using a `` to input text is generally an error, you should be
using `` 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 ``.
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.
(##) Example
Here is an example of lint warnings produced by this check:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text
res/layout/edit_textview.xml:13:Warning: Attribute android:autoText
should not be used with : Change element type to ?
[TextViewEdits]
android:autoText="true"
-----------------------
res/layout/edit_textview.xml:14:Warning: Attribute android:bufferType
should not be used with : Change element type to ?
[TextViewEdits]
android:bufferType="editable"
-----------------------------
res/layout/edit_textview.xml:15:Warning: Attribute android:capitalize
should not be used with : Change element type to ?
[TextViewEdits]
android:capitalize="words"
--------------------------
res/layout/edit_textview.xml:16:Warning: Attribute android:cursorVisible
should not be used with : Change element type to ?
[TextViewEdits]
android:cursorVisible="true"
----------------------------
res/layout/edit_textview.xml:17:Warning: Attribute android:digits should
not be used with : Change element type to ?
[TextViewEdits]
android:digits=""
-----------------
res/layout/edit_textview.xml:18:Warning: Attribute android:editable
should not be used with : Change element type to ?
[TextViewEdits]
android:editable="true"
-----------------------
res/layout/edit_textview.xml:19:Warning: Attribute android:editorExtras
should not be used with : Change element type to ?
[TextViewEdits]
android:editorExtras="@+id/foobar"
----------------------------------
res/layout/edit_textview.xml:22:Warning: Attribute android:imeActionId
should not be used with : Change element type to ?
[TextViewEdits]
android:imeActionId="@+id/foo"
------------------------------
res/layout/edit_textview.xml:23:Warning: Attribute
android:imeActionLabel should not be used with : Change
element type to ? [TextViewEdits]
android:imeActionLabel=""
-------------------------
res/layout/edit_textview.xml:24:Warning: Attribute android:imeOptions
should not be used with : Change element type to ?
[TextViewEdits]
android:imeOptions=""
---------------------
res/layout/edit_textview.xml:25:Warning: Attribute android:inputMethod
should not be used with : Change element type to ?
[TextViewEdits]
android:inputMethod=""
----------------------
res/layout/edit_textview.xml:26:Warning: Attribute android:inputType
should not be used with : Change element type to ?
[TextViewEdits]
android:inputType="text"
------------------------
res/layout/edit_textview.xml:27:Warning: Attribute android:numeric
should not be used with : Change element type to ?
[TextViewEdits]
android:numeric=""
------------------
res/layout/edit_textview.xml:28:Warning: Attribute android:password
should not be used with : Change element type to ?
[TextViewEdits]
android:password="true"
-----------------------
res/layout/edit_textview.xml:29:Warning: Attribute android:phoneNumber
should not be used with : Change element type to ?
[TextViewEdits]
android:phoneNumber="true"
--------------------------
res/layout/edit_textview.xml:30:Warning: Attribute
android:privateImeOptions should not be used with : Change
element type to ? [TextViewEdits]
android:privateImeOptions="" />
----------------------------
res/layout/edit_textview.xml:38:Warning: Attribute android:cursorVisible
should not be used with