在android xml中的一边角矩形
答
可以使用下面的XML代码来实现。唯一的缺点是第二个矩形应该与背景的颜色相匹配。
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Colored rectangle-->
<item>
<shape android:shape="rectangle">
<size
android:width="100dp"
android:height="40dp" />
<solid android:color="#F00" />
</shape>
</item>
<!-- Overlay with same color as background-->
<item
android:top="20dp"
android:bottom="-40dp"
android:right="-30dp">
<rotate
android:fromDegrees="-60">
<shape android:shape="rectangle">
<solid android:color="#FFF" />
</shape>
</rotate>
</item>
</layer-list>
不要使用该XML,它是没有意义的,而不是使用'ShapeDrawable'与自定义'Shape'类 – pskink
原谅我,但形状不显示我的屏幕为矩形,它出现作为其中两个边平行并且两个角是直角的四边形。 –