android Create a button with something above it
I wanna create a button class which 开发者_如何学JAVAextends Button.And when I click my custom button ,it will show a circle shape above it and then the circle shape dispears.The code likes: public class MyButton extends Button {
public GlowButton(Context context) {
super(context);
}
public GlowButton(Context context,AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean performClick() {
//Add the code for show the shape
return super.performClick();
}
} Is this possible ? And How can i create the shape above the button? thanks in advance!!
I believe what you can do is load an image from a drawable, where your shape has already been created. Put the shape above the button in the layout (XML) file using an imageview, and then change the visibility of that imageview to invisible on default. When the button is clicked, change the visibility to visible.
精彩评论