What Is Use Of Image Button?
Solution 1:
The Image Button control is a special type of button that displays a Drawable graphic instead of text.
The Image Button and Button controls are both derived from the View class, but they are unrelated to each other. The Button class is actually a direct subclass of Text View (think of it as a line of text with a background graphic that looks like a button), whereas the Image Button class is a direct subclass of Image View.
Solution 2:
If you will look in the API for Button you will see that it has a method called setOnClickListener that is inherited from View. Since ImageButton is also a view, you can also call the same method for it.
The only way that I see to use an image in a Button is by using android:background in the XML. This is only used for setting what's shown behind the text of a button. You should use ImageButton when you want to make a button that only uses the image as its defining feature. If you end up wanting to only see the image and have no part of the button background visible, you can set android:background on the button to use an invisible Drawable.
Post a Comment for "What Is Use Of Image Button?"