Defining Custom Views in Android

Introduction

In our previous lesson, we talked about layouts and views provided by the framework that can be used to render the desired layout. While in most cases we’ll create layouts using a combination of views and view groups to achieve the desired UI, we might come across a use case where we need to create customized views based on our requirements. For this lesson, let’s take an example of a view that accepts two strings as input and renders them as title and subtitle, as shown in the image below.

Get hands-on with 1200+ tech skills courses.