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
0
votes
1 answer

ImageButton not appearing on the screen in libgdx

I want make a image button appear in the panel, but nothing draws. Here is my code: skin = new Skin(Gdx.files.internal("uiskin.json")); texture1 = new Texture(Gdx.files.internal("badlogicsmall.jpg")); texture2 = new…
0
votes
3 answers

How can I do scale the buttonsheight?

I want to get 3 ImageButtons in one row with the same size. I want something this like:
0
votes
0 answers

Navigation drawer creates a shadow on the image button when drawer is dragged

I am having trouble when trying to drag navigation drawer on top of an image button. When the drawer button is dragged at first, it creates a shadow on the top of image button and then the drawer comes out. How to stop drawer creating a shadow on…
Richa
  • 700
  • 8
  • 12
0
votes
1 answer

Android EditText and ImageButton prevent overlaying

I've got FrameLayout which consists of EditText and ImageButton and looks like this: In the code it looks like this:
user3199693
  • 128
  • 4
  • 12
0
votes
1 answer

Changing imagebutton image(from gallery) with longclick

I've searched the forums, but not have found any specific or understandable answers for my problem. I'd like to change my Imagebutton image to a picture, selected from the gallery. Prefferrably the image should stay changed after closing the…
joonsuu
  • 3
  • 2
0
votes
1 answer

How to programmatically scale an image to the size of a ImaageButton that was created dynamically

I'm new to Android and trying to create a simple game called SoS. It's close to complete however I can not figure out how to scale the images to put in the imagebuttons. The game board is created during runtime, the user chooses a board size, 6 x…
Boo
  • 377
  • 6
  • 18
0
votes
3 answers

Image buttons are not working

I am pretty new to android programming and I am trying to create a simple home screen replacement/launcher. The application runs fine and the view pager works, but for some reason when I press on any of the image buttons nothing happens. This is my…
user3939441
0
votes
1 answer

change imagebutton resource in listview

Im working on simple feedreader app. in my main activity i have listview that show all items . in each row i have imagebutton for save that item and when user click on that the image of imagebutton must be change(like fav icon on twitter) but it…
user2549089
  • 281
  • 2
  • 4
  • 14
0
votes
2 answers

Get item in ListView when associated ImageButton is Clicked

I have an ImageButton in my child xml layout like this:
settheline
  • 3,333
  • 8
  • 33
  • 65
0
votes
0 answers

Android change position of button randomly in relative layout without going outside of screen

I am trying to change the position of an Imagebutton after the user clicks it. I am not sure how to get it to change position to only inside of the RelativeLayout I have placed over an ImageView. It will not go out on the left or top but it will go…
0
votes
1 answer

Android new Activity

In my Android application, all my views are like this: https://i.stack.imgur.com/bcUdk.jpg (reuploaded) I mean: I have a LinearLayout with a background red color for my App Title; 4 ImageButtons, when I click in each of them, I acess a specific…
0
votes
3 answers

Why am I getting a gray border around my image button?

I want to display the image as the button, but when I use ImageButton, it displays a gray border around button. I want it to be all black so that it looks like it's just the flashlight in the image! Any ideas? (The image file is just a PNG…
user2387766
0
votes
1 answer

Why is setImageResource changing the color

I'm working with android and trying to use an image button. Everything works fine, the only problem is that when I display the image on the emulator, the buttons background color is different then the background of the app. I'm on my mac and I'm…
TheBrownCoder
  • 1,186
  • 1
  • 10
  • 18
0
votes
1 answer

Clicking One Button Effecting All

So, I have this android app that is supposibly a board game. It has multiple buttons on it, and when selected, I want the selected one to gain a boarder. But, for some reason, when pressing one, it selectes everything or just doesn't deselect. What…
0
votes
1 answer

Android selector not working

I have made three different images for a next button in my activity. A focused image, normal image and an image when the button is not enabled. However, I wanted to test it and see how ot looks when it's not been enabled. So on start I set it to…
Davlog
  • 2,162
  • 8
  • 36
  • 60