Switch between a TextView and EditText

Tags: , , ,



Is this possible to interchange a TextView and an EditText. Like display the text when needed, but allow editing when needed. Is there a method (as in NON-XML) way of editing a TextView or non-editing a EditText?

Answer

Is this possible to interchange a TextView and an EditText.

Put both in your layout in the same spot. Make one invisible. Toggle visibility as needed.

Or, put both as children of a ViewSwitcher or ViewFlipper, and use that to switch between them.

Is there a method (as in NON-XML) way of editing a TextView or non-editing a EditText?

No, AFAIK.



Source: stackoverflow