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?
EditText is used for user input. TextView is used to display text and is not editable by the user. TextView can be updated programatically at any time.
Android EditText is a subclass of TextView. EditText is used for entering and modifying text. While using EditText width, we must specify its input type in inputType property of EditText which configures the keyboard according to input.
Textview : should be used for uneditable text which user wants to read but not to manipulate. e.g. News, Articles, Blogs. Plain text/ Edittext : should be used for taking user input in alphanumeric form. e.g. UserId, Comments.
The em is simply the font size. In an element with a 2in font, 1em thus means 2in. Expressing sizes, such as margins and paddings, in em means they are related to the font size, and if the user has a big font (e.g., on a big screen) or a small font (e.g., on a handheld device), the sizes will be in proportion.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With