October 2017
Intermediate to advanced
294 pages
6h 49m
English
We have our custom view that adapts to multiple sizes now; that's good, but what happens if we need another custom view that paints the background blue instead of red? And yellow? We shouldn't have to copy the custom view class for each customization. Luckily, we can set parameters on the XML layout and read them from our custom view:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="OwnCustomView">
<attr name="fillColor" format="color"/>
</declare-styleable>
</resources>
Read now
Unlock full access