我在 Android 中使用 layer-list xml 自定义布局。但是,我完成了 layer-list 并确切地看到了我想要自定义的内容。但是,当我在我的布局中应用时,它显示的并不完全是我想要的,我不知道为什么。请帮助我!这是我的 layer-list.xml:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<size
android:width="@dimen/dp35"
android:height="@dimen/dp35" />
<solid android:color="@color/colorAccent" />
</shape>
</item>
<item android:right="12dp"
android:top="@dimen/dp20"
android:bottom="-5dp">
<rotate
android:fromDegrees="25">
<shape android:shape="rectangle">
<solid android:color="@color/colorAccent" />
</shape>
</rotate>
</item>
<item android:left="12.5dp"
android:top="@dimen/dp20"
android:bottom="-5dp">
<rotate
android:fromDegrees="-25">
<shape android:shape="rectangle">
<solid android:color="@color/colorAccent" />
</shape>
</rotate>
</item>
我的布局使用 layer-list.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@drawable/bg_sale_off"
android:text="Textview"
android:layout_centerInParent="true" />
</RelativeLayout>