I want to convert editText
view in whole app, from a single place, so that when we will have to change, we change it only one place.
2 Answers
What you're looking for is called style or subclassing:
Style:
You define some attributes in your style (width, height, for instance) and you apply this style to all your EditText
. Applying a theme gives the more or less the same result except that a theme is set for a whole Activity
and not for UI Element. More infos
Subclassing:
If you want to do something more complicated, you can subclass the EditText
class and modify its attributes or method (you make a kind of 'custom' view then).

- 2,766
- 3
- 33
- 57
-
Actually we have a app which is on play store , we have to do service of that app, now the requirement is only change the font size ,text color and layout. – Sep 27 '15 at 07:09
-
1Then I would create a style in the `styles.xml` and apply this style to all `EditText`, compile and do an update... – Laurent Meyer Sep 27 '15 at 07:11
If you are looking to change the behavior of the EditText
considerably, you should create a custom View
class overriding (extending from) EditText.
If you are looking to change how it looks in the whole application, you should change it in your theme (styles.xml
). Refer to this well-written answer to change the style of an EditText
application-wide - https://stackoverflow.com/a/7188452/1086930
-
You can change the look in the subclass as well, subclassing is just more powerful... – Laurent Meyer Sep 27 '15 at 07:06