How do I create a drawable for my custom separator?
I'm trying to create a separator line in my android view. The setup I want is for the drawable to be 2px tall and width set to fill_parent, with the bottom 1px being a white line and the top 1px being a black line with an alpha component. It seems like this should be possible with layer-list using an offset, but, as the documentation warned, the view starts scaling all of the items and then the blending messes up the delineation.
I have this working using a png and scaling and it looks alright on my test device and emulator, just thought it would make more sense to define it ex开发者_JS百科plicitly in xml rather than making a custom png for every type of separator. An
What about using a ShapeDrawable? You can define it in XML and use as you would a png.
精彩评论