Time for action - rendering a spinner ring

By default, a shape will assume that it's being used as part of a LevelListDrawable, and may not appear unless you disable this behavior. You do this by specifying the useLevel attribute as false on the shape element. If you don't disable this functionality, the ring will not render correctly, or at all.

  1. Create a new shape resource XML file in the res/drawable directory named spinner.xml and open this file in an editor or IDE.
  2. Start the root element of the file as a ring shape:
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="ring"
    
  3. The ring shape requires its relative thickness to be set on the shape declaration:
    android:innerRadiusRatio="3.2" android:thicknessRatio="5.333" ...

Get Android User Interface Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.