0

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.

tomab
  • 2,061
  • 5
  • 27
  • 38

2 Answers2

3

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).

Laurent Meyer
  • 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
  • 1
    Then 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
2

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

Community
  • 1
  • 1
jaibatrik
  • 6,770
  • 9
  • 33
  • 62