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
2 answers

How to create a ListView of Buttons that play different sounds on click

I need to make an Activity with a ListView that could have more than 50 ImageButtons that each play a different Sound. This is the main activity (that would have the buttons):
0
votes
1 answer

How to download the Image which is pointed by Image button in android chat application

How to download the image which is pointed by Image button in android .I have dynamically created this image button using the image url from the server.Any help is appreciated
0
votes
1 answer

Android: Image button size for multiple screen sizes but with same density

I am writing an Android app to have a matrix of image buttons. I tested it with 2 devices: Galaxy Note 1 (5.3") and Galaxy tab 8.0 (8.00 "). When the source images are put in different density drawable folders, both devices took the images from…
0
votes
1 answer

Android Sharedpreferences wont save

I have created a code that worked when i had a regular button called "@+id/buttonSave_character" however, when i remove it and add a image button and try to save the values i have stored in edittext, it wont do it. what is wrong with the…
PuchuKing33
  • 381
  • 3
  • 7
  • 19
0
votes
3 answers

Android - setOnClickListener crashing in fragment

I am working on an activity which uses two fragments, one for displaying images on a canvas and the second which features buttons to affect elements on the canvas. I have just set up onClickListeners for the two buttons, and now the program is…
user2828965
  • 405
  • 1
  • 6
  • 17
0
votes
5 answers

The only image for all button states for Android?

I have an image for my button. In order to make use of it I have to have 1 additional image for each state: 1. disabled 2. selected 3. pressed etc.. in iOS all those additional states are handled automatically and deferred from original image…
Mando
  • 11,414
  • 17
  • 86
  • 167
0
votes
1 answer

Android: layout for a simply menu

In my app I have a view with a menu in this way... but I want adapt these 4 buttons for all type of screen, that is I want that these buttons have a dynamic size... do you have any suggestions? thanks this is my current code...
cyclingIsBetter
  • 17,447
  • 50
  • 156
  • 241
0
votes
5 answers

Change background on click android

I'm trying to change the color of my background of view when I click on a button but the app won't open with the code I have right now I don't know what the problem is.. Code: package on.click.button; import…
Tim Jake
  • 57
  • 2
  • 8
0
votes
2 answers

Add icons to drawalbe

I have several 512 x 512 icons so they are high resolution icons. I placed alle the icons under drawable-xxhdpi in my android project. The name of the icons are all correct (they start with ic_) and they are all .png Unfortunately im unable to use…
Mulgard
  • 9,877
  • 34
  • 129
  • 232
0
votes
5 answers

ImageButton onClick not called in RelativeLayout in a Fragment using a transparent ActionBar

any ideas why my ImageButton isn't working in my Fragment? The ImageButton contains a Drawable and is transparent. When I place it in my RelativeLayout below, its…
Bobbelinio
  • 134
  • 1
  • 8
0
votes
1 answer

ImageButton set src as StateListDrawable

I'm trying to create a ImageButton that changes it's icon based on wether it's enabled or not. I've created the following file:
martin treurnicht
  • 1,223
  • 1
  • 10
  • 17
0
votes
3 answers

Android: ImageButton with a dynamic size and fixed position

In my app I want set an ImageButton in a position in this way and I want adapt this button in this way for all screen, is there a strategy to obtain it?
cyclingIsBetter
  • 17,447
  • 50
  • 156
  • 241
0
votes
0 answers

Image src is not fit in ImageButton for different screen size

I followed every approaches but nothing works for me. Here is the case, I have five ImageButtons which are in row and each has a icon and background drawable:
A23149577
  • 2,045
  • 2
  • 40
  • 74
0
votes
3 answers

Moving items on Android layout to other side of screen

I have a layout in my app that has four image buttons. I want the last two image buttons, the reload and stop buttons to be on the right side of the screen, with empty space between the two buttons. How would I achieve this? I've heard of Space but…
Sega dude
  • 1,103
  • 3
  • 12
  • 29
0
votes
1 answer

How to set return imagebutton's Alpha to the default when I back to the previous page

My homepage has a imagebutton. When I click the imagebutton, imagebutton's Alpha will change to 150. But when I back to the previous page, the imagebutton will still show Alpha(150) Instead of the default Alpha. How can I do when I back the previous…
Jeff_Huang
  • 15
  • 4