I’d like to show the basics of animated views with a simple ProgressView.
It’s not a fancy one, but good enough for explaining the behavior
The final result is like this.
Here’s the part of the core logic of the view
Also we can add custom attributes for this view. To add custom attributes, first of all you have to add new resource layout named as attrs.xml to res/values. The content of the attrs.xml would be like follows
After defining this attributes, you can use them inside your layout.xml like this
As you can see here root view (RelativeLayout for this case) has the parameter xmlns:progress=”http://schemas.android.com/apk/res/com.bafoly.tutorials”
“Progress” is the name I’m assigning for my custom attributes. And the com.bafoly.tutorials is the package of my android application.
And for my custom ProgressView, I just add progress:colorInside=”…”, progress:colorOutside=”…”, progress:radius=”…” parameters.
When the activity displays this view, following constructor is called.
This is how you can create your own custom views.