5. Views
Of all the pieces of the Android system, views are probably the most used. Views are the core building block on which almost every piece of the UI is built. They are versatile and, as such, are used as the foundation for widgets. In this chapter, you learn how to use and how to create your own view.
The View Class
A view is a rather generic term for just about anything that is used in the UI and that has a specific task. Adding something as simple as a button is adding a view. Some widgets, including Button
, TextView
, and EditText
widgets, are all different views.
Looking at the following line of code, it should stand out that a button is a view:
Button btnSend = (Button) findViewById(R.id.button);
You ...
Get Android™ Development Patterns: Best Practices for Professional Developers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.