How to set background color inside border in android studio?

I am trying to set border for which i have made this border.xml file, as i have used background keyword to set background color, but there is no effect of adding background keyword. Can anyone guide me how can i set background color inside border. Here is my border.xml code:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">  
<corners android:radius="3dp"/>
<padding android:left="5dp" android:right="5dp" android:top="5dp" android:bottom="5dp"/>
<stroke android:width="5dp" android:color="#A5A5A5" android:background="#2B1B1B"/>
</shape>

1 answer

  • answered 2019-10-08 05:32 Puneet

    Removeandroid:background="#2B1B1B" from 5th line of the code and use this fter third line of your code

    `<solid android:color="#2B1B1B"/>`