2

I've seen on other apps people using the really nice looking borders/dividers that look like they are inset.enter image description here

Something like that. I'd like to create one of my own using an XML drawable and I'm a little confused about how it needs to be done. I know I'm going to have to use a layer-list and I even found another question that describes how to write the XML here: Create gradient border in android?

Going off of that question though, I don't understand the last part of step 3:

// specify here where you want to have a stroke(top, left, right, bottom)

android:top="3dp" android:right="0dp" android:bottom="3dp"
android:left="3dp" />

Which file does that code go in an on which element?

Community
  • 1
  • 1
user1513171
  • 1,912
  • 6
  • 32
  • 54

1 Answers1

0

The solution I have learned is to use a 9-patch background. 9-patch backgrounds are how Android achieve button styles. In my case I had a custom view that I wanted to behave/be triggered like a button (to imitate an HTML5 equivalent) but I created it off a FrameLayout > RelativeLayout > [controls] view. I then created a background using graphic tool styled the way I want. Imported it into Android Studio > raw folder. Right-click to 'Creaate 9-Patch...'. After adjusting the 9-patch that I stored in /drawable folder, I then used it is a background for my custom view. It gave me a perfect result.