I created my custom drawable. And to draw it, I'm using the bounds. But, when the user use:
android:layout_width="match_parent"
android:layout_height="wrap_content"
I get bounds.height() == 1. Then, I want to use as height = 0.8 * bounds.width.
I tried it, because when the user use WRAP_CONTENT I get bounds.height() = 1. So then I set my drawable height to 0.8*width(). But I don't get the proper size. I just get like the height is 1. I read that you need to call invalidate(), but how do I call it, because if I call invalidate() in draw() then the method is called infinitely.
You should use onMeasure method.
Lifecycle call it when it's need to invalidate size of view you working on.