0

I want to generate background drawable shape which has grey color and bottom is 2dp thick and of black color.

I have tried the following

<?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="#D3D3D3" /> 
    </shape>
  </item>   
    <item android:bottom="2dp" >  
     <shape android:shape="rectangle"> 
      <solid android:color="#000000" />
    </shape>
   </item>    
 </layer-list>

But unable to generate the desired shape. How can it be done?

LearningBasics
  • 660
  • 1
  • 7
  • 24

1 Answers1

0

If you switch the 2 colors it should work.

<?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="#000000" />
    </shape>
</item>
<item android:bottom="2dp" >
    <shape android:shape="rectangle">
        <solid android:color="#D3D3D3" />
    </shape>
</item>
</layer-list>

enter image description here

Elodie E2
  • 580
  • 3
  • 10