있습니다. 여기
라는 모양 파일
arrow_shape.xml
입니다 :
: 예 여기
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/arrow_shape"/>
를 들어,
<?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="#5EB888" />
<corners android:radius="0dp"/>
</shape>
</item>
<!-- This rectangle for the top arrow edge -->
<!-- Its color should be the same as the layout's background -->
<item
android:top="-40dp"
android:bottom="65dp"
android:right="-30dp">
<rotate
android:fromDegrees="45">
<shape android:shape="rectangle">
<solid android:color="#ffffff" />
</shape>
</rotate>
</item>
<!-- This rectangle for the lower arrow edge -->
<!-- Its color should be the same as the layout's background -->
<item
android:top="65dp"
android:bottom="-40dp"
android:right="-30dp">
<rotate
android:fromDegrees="-45">
<shape android:shape="rectangle">
<solid android:color="#ffffff" />
</shape>
</rotate>
</item>
</layer-list>
다음
버튼의 배경으로 사용하면 스크린 샷입니다
Layer-List
에 대한 자세한 정보는 here입니다.
는 편집 :는
내가 모양의 폭과 높이에 대한 특정 값을 사용하는하지만 명심하십시오. 이들을 변경하면 top, bottom and right attributes
의 값을 변경해야 할 수도 있습니다. 따라서이 경우 프로젝트의 values
디렉토리에서 다른 값을 사용하는 것이 좋습니다.
배경이 동적 인 레이아웃 인 경우 흰색 레인 [! [이미지 설명 입력] (http://i.stack.imgur.com/FKtR1.png)] (http : //i.stack. imgur.com/FKtR1.png) –