如何在Android上创建此类背景?我不知道该怎么做。
这就是我试过的
triangle.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<rotate
android:fromDegrees="-77"
android:pivotX="0"
android:pivotY="0"
android:toDegrees="0">
<shape android:shape="rectangle">
<solid android:color="@color/colorPrimary" />
</shape>
</rotate>
</item>
</layer-list>
layout.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="br.com.fornaro.armariovirtual.AccountCreatedActivity">
<View
android:id="@+id/background"
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="@color/colorPrimary"
android:elevation="@dimen/elevation" />
<View
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/background"
android:background="@drawable/triangle"
android:elevation="@dimen/elevation" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/view"
android:layout_centerHorizontal="true"
android:elevation="@dimen/elevation"
android:gravity="center"
android:text="@string/account_created"
android:textColor="@android:color/white"
android:textSize="30sp" />
<Button
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:drawableEnd="@android:drawable/ic_media_play"
android:drawableRight="@android:drawable/ic_media_play"
android:drawableTint="@color/colorPrimary"
android:text="@string/continue_label"
android:textColor="@color/colorPrimary"
android:textStyle="bold" />
</RelativeLayout>
如何解决这个三角形?或者使用更好的方式进行此布局?