I have this shape defined in an xml file, and need to create it in code but am stumped.
I assume I want to instantiate a RoundRectShape and set its properties to those in xml, but properties don’t line up very well.
RoundRectShape(float[] outerRadii, RectF inset, float[] innerRadii)
My xml shape only has 1 radius, now RectF, and the RoundRectShape has no options for setting padding or colors?
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#00FFFFFF" />
<stroke android:width="2dp" android:color="#FFFFFFFF" />
<padding android:left="7dp" android:top="7dp"
android:right="7dp" android:bottom="7dp" />
<corners android:radius="4dp" />
</shape>
You need to create custom drawable siomething like the following
Sample Code