Android Custom Components


Welcome to this review of the Pluralsight course Android Custom Components by Chiu-Ki Chan.

Chiu-Ki is a mobile developer with a passion in speaking and teaching.

She runs a mobile development company, producing apps such as “Monkey Write” for learning Chinese writing and Heart Collage for snapping photos to stitch into a heart.

Android Layout Fundamentals is the 11th course in the Android Learning Path.

Android Custom Components


Chiu-Ki begins by categorizing the built-in components that Android provides:

  • Simple View (e.g. TextView)
  • Container (e.g. LinearLayout, ListView, GridView)
  • Compound Control (e.g. TimePicker)

So why might we want to create a custom component? Chiu-Ki gives 4 reasons:

  1. Modularize repeated code
  2. Access protected methods
  3. Optimize rendering speed
  4. Complete control with draw, measure and layout

Chiu-Ki says there are several techniques usedin this course:

  • Shortcut View and ViewGroup – for modularizing repeated code
  • Custom View – for customizing size and appearance of simple view
  • Custom ViewGroup – Container for child views

In this course these techniques are learnt using a couple of fun examples:

  • Pizza
  • Photo spiral

Extend a simple view

In this module we:

  • Reuse parent class functionality
  • Add only the part we need
  • Modularize code into custom view

We make our first custom view and use 3 constructors: 1 for Java, 1 for xml and 1 for xml with style.

We learn that we should choose a parent view closest to what we need.

Compound control

We learn that a compound control is a group of views, often with additional functionalities.

We look at the LengthPicker: a LinearLayout with 2 buttons and a TextView.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s