I have recently encountered a very specific issue/requirement regarding an Android Button and ListView item. The requirement is something like this:
- we need a button that can display a glow/aura of a specific dimension and opacity when clicked, however this glow/aura must not be part of the button itself and needs to be displayed over the neighbouring views.
- same requirement for list view items – they need to glow over their neighbouring items and the list view margin.
Any idea/suggestion would be highly appreciated.
Thanks.
A solution could be in drawing a round rectangle with stroke around the button. You can get the button position using View getTop(), getLeft(), getRight() and getBottom() methods.
The round rectangle could be a custom view that has the onDraw() method overridden. You can also have a paint attribute, in this view, if you what to add the gradient and opacity, to look more like an aura. When you first create the view it should be invisible or transparent and only on demand it should appear.
From your main activity you have to add this new view, by using the layout.addView() method and depending on your demands you can make it visible and/or change their properties.
An example can be found here: https://github.com/codesorcerers/auraview
Hope this helps!
Bogdan Popa