2017-04-13 20 views
1

我有以下矩形黑色與圓角,並希望添加頂部,左側和右側邊框只有白色。如何使形狀的頂部和側面變白?

當我使用中風時,四面都會有邊框,但我不想讓按鈕有一個。

enter image description here

這是我目前的形狀:

<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
<solid android:color="#000000" /> 
<corners android:radius="1dp" android:topLeftRadius="6dp" android:topRightRadius="6dp" android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" 
    android:color="#fffffff"/> 

+0

可以請您解釋更多 –

+0

我編輯了圖像。請看白色邊框。邊框應位於上方,左方和右方。但不是在buttom – skm

回答

1

這裏是完美的解決方案!

<?xml version="1.0" encoding="utf-8"?> 
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > 
<item> 
    <shape 
     android:shape="rectangle"> 
     <solid android:color="@android:color/black" /> 
     <padding android:bottom="-10dp"/> 
     <padding android:top="10dp"/> 
     <padding android:right="10dp"/> 
     <padding android:left="10dp"/> 
     <corners android:topLeftRadius="10dp" android:topRightRadius="10dp" 
      android:bottomLeftRadius="0.1dp" android:bottomRightRadius="0.1dp"/> 
    </shape> 
</item> 

<item> 
    <shape 
     android:shape="rectangle"> 
     <stroke android:width="1dp" android:color="@android:color/white" /> 
     <padding android:bottom="1dp"/> 
     <corners android:radius="10dp" /> 
    </shape> 
</item> 
</layer-list> 
+0

你解決了你的問題? –

+0

完美,謝謝! – skm

+0

我已經完成了,再次感謝。你是一位有經驗的Android開發人員嗎 – skm

相關問題