I’m developing an App, and I need to draw borders and separators on a View, like the eBay app.
I think on a combination of shapes and view with 1dp. There is another easy way?
Many thanks.
I’m developing an App, and I need to draw borders and separators on a View, like the eBay app.
I think on a combination of shapes and view with 1dp. There is another easy way?
Many thanks.
3
Answers
or you could use margins at the bottom, for the view which is just above the empty space.
If you mean how the views are grouped together so that some have curved corners on top, others in the bottom plus padding or a margin, and others with no curved corners at all, then this is one way to do it.
If you are using ListView with ListAdapter then When overriding
getView(int position, View convertView, ViewGroup parent)
determine fromposition
what view should be returned and return it. You can change the view’s padding and margins before returning it.Also, it’ll be more efficient if you override
getItemViewType(int position)
and return a constant representation a view type for a specific position so that Android can reuse views and you wont have to inflate a new one or change the attributes every time.Create a 9-patch image for the outside border. Use that as the background resource and it will give you the rounded corners with solid border. For dividers, you can create a simple view and have another background resource that’s a simple image with the same color as the border in the 9-patch.