1

I'm trying to define a background drawable in XML that will make the background have a 1dp grey border on the left. The XML I'm using is:

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#00FFFFFF" />
    <stroke android:width="1dp" android:color="#CCCCCC" />
    <padding android:left="1dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
</shape>

In the screenshot below you can see that it's actually putting a 1dp border around the entire view (the "Recent Lessons" area):

enter image description here

Can someone explain to me what I've done wrong here?

Jeremy Logan
  • 47,151
  • 38
  • 123
  • 143

1 Answers1

1

I think that you may have confused padding and stroke. The 1dp stroke you are adding is the border you see around the shape - not the padding. Try following these examples. For more about LayerList see the android docs (LayerList section). Basically, it boils down to multiple drawables as one.

Community
  • 1
  • 1
Scott
  • 1,652
  • 1
  • 13
  • 10