I have a rectangle shape view in XML:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/lightblue"/>
</shape>
What I want is cut it in half, so result will looks like:
Is it possible? And if yes, how do I achieve it?
Note:
1) Adding rotated white rectangle isn't solution. I need to keep cutted area of the blue shape transparent (there are more View layers under it).
2) Bottom left corner of rect is a bit rounded (I forgot to draw it in image above).
use a
ShapeDrawable
like this:where class
S
is a customShape
:now you can use
Drawable d
in any call toView#setBackground()
,TextView#setCompoundDrawables()
etc