
Embedded games in mobile apps: Make your app more attractive

9. Feb 2022
AndroidWhat is Android Custom View? Android as a platform offers several visual components (referred to as Views), whose task is to draw the pixels that represent this View on the screen correctly and in the right place.
A "good" View looks good, is easy to style, takes into account the limitations / recommendations of the framework and provides a simple interface for the programmer. This series is supposed to help us gradually immerse ourselves in the secrets of such Views, which are beyond the scope of the platform. Android as such does not directly provide them. We call this Views Custom Views.
As examples, we can imagine various graphs, equalizers or navigation and auxiliary elements such as page indicators and the like.
This series is intended for programmers of native Android applications (Java / Kotlin), who master at least the broader basics of Android and they want how to know write they own elements. Jetpack Compose will not be part of this series and will be mentioned only marginally.
We only need to create a Custom View if none of the available Views is sufficient for our needs. So:
To create custom views, we can follow such a mind map. So if:
We can also consider working with ViewBinding and Kotlin as a special case, when extension functions can often suffice. We will also be very interested in JetPack Compose in the very near future.
To give our Custom View enough power and possibly share it with the world, it should also provide the following features:
The list can be huge and some of the points mentioned are not necessary. We simply want to create a better quality and more widely usable View.
Gradually, we will go through all the mentioned alternatives. Let's see how to create Compound ViewGroup, Custom ViewGroup and Custom View. We will stick to Best-Practices and try to answer the most frequent questions associated with creating these components. Stay Tuned and Buckle Up !!!