我試圖創建與在外面和圓形的內方角佈局的邊界。我收集了,我需要創建兩個形狀組成的XML定義繪製:一個筆劃寬度和拐角半徑和另一隻筆劃寬度:方形佈局邊界內邊
可繪製/
round_border.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="4dp" android:color="#FF000000" />
<padding android:left="7dp" android:top="7dp"
android:right="7dp" android:bottom="7dp" />
<corners android:radius="4dp" />
<solid android:color="#FFC0C0C0" />
</shape>
square_border.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="2dp" android:color="#FF000000" />
<solid android:color="#FFC0C0C0" />
</shape>
每個作品的independantly作爲邊界時appliedby本身就像這樣:
機器人:背景= 「@繪製/ round_border」,但是當它們之一或兩者都加入到一個項目,列表中可繪製的,像這樣:
composite_border.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<layer-list>
<item android:drawable="@drawable/round_border"/>
<!-- <item android:drawable="@drawable/square_border"/> -->
</layer-list>
</shape>
和:
機器人:背景=「@繪製/ composite_border」
佈局的背景完全是黑色的,而不是隻是一個黑色邊框 - 任何人都知道如何使該任務的圖層列表的工作?
感謝分享這! – cV2