我使用XML文件,这样做是为了下面的后退按钮
https://drive.google.com/file/d/0B1cySRpqElgyTkptOFpQa3NsdDQ
:
left_arrow.xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item >
<rotate
android:fromDegrees="-45"
android:toDegrees="-45"
android:pivotX="89%"
android:pivotY="-22%" >
<shape
android:shape="rectangle" >
<stroke android:color="@color/calendarOrange" android:width="3dp"/>
<solid
android:color="@color/drakBlue" />
</shape>
</rotate>
</item>
</layer-list>
button_body.xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:left="-4dp">
<shape android:shape="rectangle" >
<stroke android:color="@color/calendarOrange" android:width="3dp"/>
<solid
android:color="@color/drakBlue" />
</shape>
</item>
</layer-list>
让他们一起:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:weightSum="1.0"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/left_arrow"
android:layout_weight="0.7"
>
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/button_body"
android:layout_weight="0.3"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="@color/white"
android:text="Back"
android:gravity="center"
android:textStyle="bold"
android:textSize="22dp"
/>
</RelativeLayout>
</LinearLayout>
PS:您可能需要改变安卓pivotX和安卓pivotY参数取决于你conteiner布局
我已更新问题...请检查 – aNi
您的形状有5个c orners。内置的int形状是矩形,椭圆形,线形和环形。您仍然可以使用您的选择器,只需生成不同版本的9修补程序可绘制图形资源。 – Krylez