Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Actual difference between TextView and Button

Considering the main purpose of a button is to react to a click event, and the fact that both Button and TextView has properties for text, drawable (icon) and click event, what is the actual difference between them, when should you chose one over the other?

like image 431
Christopher Francisco Avatar asked Jul 23 '14 01:07

Christopher Francisco


1 Answers

Looking at the reference docs, the Button class extends the TextView class. From there, the Button adds a few stylistic changes (e.g., default background image, additional padding) to allow quicker adaptation to your designs.

IMO, the one you choose to use should depend on how you want to design your app. If you use the default theme with minimal stylistic changes, Buttons can be quicker to visualize; on the other hand, if you are doing a lot of customization, TextView will let you do that much easier.

**Edit: ** GrepCode shows that from a functionality point of view, there is no difference aside from class name.

like image 165
seeming.amusing Avatar answered Oct 01 '22 04:10

seeming.amusing