Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Building Android UIs with Custom Views

You're reading from   Building Android UIs with Custom Views Build amazing custom user interfaces with Android custom views

Arrow left icon
Product type Paperback
Published in Oct 2017
Publisher Packt
ISBN-13 9781785882869
Length 294 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Raimon Ràfols Montane Raimon Ràfols Montane
Author Profile Icon Raimon Ràfols Montane
Raimon Ràfols Montane
Arrow right icon
View More author details
Toc

Basic rendering

So far we've only been drawing a solid background or a linear gradient. That's neither exciting nor really useful. Let's see how we can draw more interesting shapes and primitives. We'll do so by creating an example of a circular activity indicator that we'll be adding more and more features to in the following chapters.

Creating the basic circular activity indicator

The Canvas class provides us with many drawing functions; for example:

  • drawArc()
  • drawBitmap()
  • drawOval()
  • drawPath()

To draw a circular activity indicator, we can use the drawArc() method. Let's create the basic class and draw an arc:

public class CircularActivityIndicator extends View { 
    private static final...
You have been reading a chapter from
Building Android UIs with Custom Views
Published in: Oct 2017
Publisher: Packt
ISBN-13: 9781785882869
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime