Questions tagged [android-imagebutton]

Displays a button with an image (instead of text) that can be pressed or clicked by the user.

Displays a button with an image (instead of text) that can be pressed or clicked by the user.
By default, an ImageButton looks like a regular Button, with the standard button background that changes color during different button states.
The image on the surface of the button is defined either by the android:src attribute in the XML element or by the setImageResource(int) method.

To remove the standard button background image, define your own background image or set the background color to be transparent.

To indicate the different button states (focused, selected, etc.), you can define a different image for each state.
E.g., a blue image by default, an orange one for when focused, and a yellow one for when pressed. An easy way to do this is with an XML drawable "selector."

Reference page: http://developer.android.com/reference/android/widget/ImageButton.html

511 questions
-2
votes
1 answer

Image gets blur when setting as a background to Button,ImageButton

Hi in my app there are 6 buttons and each has a background image,Problem is Image gets blur when setting as background.I have tried all the sizes but problem remains same.I also tried setting it for ImageView,Button and ImageButton. What should be…
Sunil
  • 49
  • 1
  • 12
-2
votes
1 answer

Adding shadow to drawable for a ImageButton

I have a image button which is designed like this
55597
  • 2,033
  • 1
  • 21
  • 40
-2
votes
1 answer

ripple to an ImageButton not working

I am trying to add ripple on my image button but it won't work
-2
votes
1 answer

Is there an action opposite to ImageButton.setImageSource() on android?

I need to get the image's resource of image button. Did someone have way to do it?
Oster
  • 1
  • 3
-3
votes
1 answer

android studio imagebutton from internet

i am programming an app with AndroidStudio and want to use an ImageButton to Display an Image. The Problem is, that this Image is from the Internet and I just found a method to use Pictures in the R.mipmap.*** for the ImageButton. Does anyone have…
-3
votes
1 answer

ImageButton won't change Activity when clicked, but normal Buttons will

I'm making a simple app that shows information for a game and decided to use the character avatars as the ImageButton to switch to the page that has information on them, but when they are pressed they do not switch the Activity The xml for the…
Jake G
  • 3
  • 3
-3
votes
1 answer

Why is changing of ImageButton's image resource not changing the button's image?

I'm writing a memory game app for android and calling setImageResource() method of an ImageButton often has no effect whatsoever. So the idea is you have a random number of hidden images on screen (in this particular case we have 4 buttons),…
Schonn
  • 1
  • 4
-3
votes
1 answer

Change Color of ImageButton on Scrolling?

I have the following Android ImageButton: The…
Michael
  • 32,527
  • 49
  • 210
  • 370
-3
votes
2 answers

How Can I Make my ImageButton go to another activity in Android Studio?

I want to know how I can make my ImageButton to go to another activity in Android Studio 1.2.2? I tried to make it using the way that was made for buttons. This is my Java code @Override protected void onCreate(Bundle savedInstanceState) { …
Max Technology
  • 13
  • 1
  • 1
  • 2
-4
votes
1 answer

Ripple effect activated on backpressed

as title says, how to make my ripple effect on ImageButton (ripple effect assigned to this ImageButton) activated on backpressed() without back to the previous activity
meeftah
  • 95
  • 1
  • 1
  • 13
-4
votes
2 answers

ImageButton with shape in android

I have a ImageButton and I used a shape to transform it in a circle. But when I try to change the color of the ImageButton the shape doesn't work, what can I do to fix it?
L . Android
  • 33
  • 10
-4
votes
2 answers

Android Image Button

Android app, i wrote to test image button doesn't work. I have created a image button and implement an event listener for that button. What's wrong with this source code? import android.view.View; import android.view.View.OnClickListener; import…
-5
votes
1 answer

onClick method works only in MainActivity

I have a ImageButton and i want to use it in a certain Fragment class of my application. But when i use it in my fragment class the app crashes. BUT i can use it in my MainActivity without crashing. How can i fix this? This is the code i'm using in…
CraZyDroiD
  • 6,622
  • 30
  • 95
  • 182
-6
votes
2 answers

@Override Method does not override from it's superclass

I just Started on learning java for our thesis. Why does @Override Method does not override from it's superclass import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import…
-6
votes
2 answers

Change ImageButton Drawable automatically

I have 320 images in drawable directory and ImageButton so when it's clicked, the Image have to be changed randomly, the image name is like this file_xyz, the xyz are numbers each one generated randomly using this code: rand = new…
anon
1 2 3
34
35