0

What I Want

I want to convert EditText into TextView programmatically.

<EditText
    android:id="@+id/inputValue"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:inputType="number" />

how can I convert the above EditText to below TextView

<TextView
    android:id="@+id/textView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="TextView" />
Haris
  • 372
  • 3
  • 16

1 Answers1

2
  1. You can use 1 edittext and 1 Textview on same postion and hide them according to your need

    or

  2. You can use editText.setEnabled(false);

Manjeet deswal
  • 692
  • 2
  • 5
  • 18
  • 1
    Thank You So Much, That is exactly what I wanted. 2nd option perfectly worked for me. – Haris Mar 07 '22 at 07:03
  • this doesn't actually convert the edit text to a textview - you're either just using two, or disabling it, so the original question was just asked incorrectly and needed to do more research, as this is something which could have been easily found – a_local_nobody Mar 07 '22 at 07:31