Book Image

Building Android UIs with Custom Views

By : Raimon Ràfols Montane
Book Image

Building Android UIs with Custom Views

By: Raimon Ràfols Montane

Overview of this book

To build great user interfaces for your Android apps that go beyond the standard UI elements, you need to use custom Android views. With these, you can give your app a distinctive look and ensure that it functions properly across multiple devices. This book will help you construct a great UI for your apps by teaching you how to create custom Android views. You will start by creating your first Android custom view and go through the design considerations. You will then see how the right choices will enable your custom view to perform seamlessly across multiple platforms and Android versions. You will create custom styleable attributes that work with Android XML layouts, learn to process touch events, define custom attributes, and add properties and events to them. By the end of this book, you will be able to create apps with custom views that are responsive and adaptable to make your app distinctive and an instant hit with its users.
Table of Contents (12 chapters)

Summary

In this chapter we have seen how to build a charts custom view to draw graphs in our Android applications. We have also quickly covered how to manage paddings, RTL / LTR support, and we have finally added some complexity to our custom view by supporting multiple data sets or adding the features of zooming and scrolling.

Also, the way we've implemented this custom view; using independent data ranges and adapting it dynamically to the screen, means it'll automatically adjust to any screen resolution or for example, to an orientation change. This is usually a good practice and will prevent many issues when testing our custom view on several devices. In addition, making the sizes of everything we draw on the screen depend on the screen density, like we did in our previous example, will make the portability even easier.

In the next chapter, we will show how to build...