I'm trying to figure out how to make a custom EditText that has black borders along it's right and left sides, a green border on top, and a blue border on the bottom. See below:
I'm fairly new to Android development and I've spent quite a lot of time reading their documentation but haven't had any luck finding anything on this kind of customization. I know in CSS you can just use the border-right, border-left, etc... properties but not sure if it's that straightforward in Android development. I'm looking for the solution that is the most compatible, preferably from version 2.3 (Gingerbread).
You'll have to make a custom image to use as the background. It's relatively straight forward, you'll want to use a 9-patch as described in the 2D graphics guide.
Once you have that, you'll put it in your res/drawable folder of your project, and then use it with the EditText in XML as
create a
LayerList
with a square colored in the wanted gradient, and above it a white square with some borders. then use this drawable as yourTextView
background.You can create a Multi-colored border EditText using 9-patch or in xml
<layer-list>
here i am creating Multi-colored border EditText programmatically.Source android--code