I am trying to make a frame from code so that I can apply it to make rounded inner corners with a solid fill outside and transparent inside. Just like a solid rectangle with transparent oval inside. picture attached. I have tried few shape combinations all that available online displays the corners outside.
The inside should be transparent not white. The image is taken from this post but the solution presented here is not what I am looking for I dont want to use a 9 patch drawable but would like to be created in code.
Please valid answers only.
create the following rounded_corner.xml:
add this below your imageView, which you want to apply the frame on it:
tweaking @Nima K solution, to avoid using an extra View
create frame.xml @ drawable
Then use it with 'android:background' attribute of your view
And this is the result
First of all, create 3
xml
layout
in drawable folder:(You can change this name as you wish),
frame.xml:
frame_build.xml :
red.xml
Finally refer your view or layout to Frame XML as follow :
This tested and output as below image:
Hope this help .