I am trying to make two rounded edges views, A and B, in Android. Both views have the same corner radius but B is within A or B should look like within A.
B's width is dynamic according to the percentage below. When the percentage is more than 5%, this works perfectly fine. However, as the percentage is less than 5%, it will turn out like the failure-figure below. They look like completely independence views, though they actually are. I need the green part grows within the gray area only. How can this be accomplished?
Ideally, it should look like
But I failed to make it. :/ The figure I got
Here is what I did, define a drawable as given below
<RelativeLayout
android:id="@+id/percentageBarViewGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:id="@+id/a_Bar"
android:layout_width="match_parent"
android:layout_height="20dp"
android:background="@drawable/progress_bar_empty_background"/>
<View
android:id="@+id/b_Bar"
android:layout_width="0dp"
android:layout_height="20dp"
android:background="@drawable/progress_bar_progressing_background"/>
</RelativeLayout>