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

Playing sounds inside of a fragment using MediaPlayer

I am creating a soundboard app. The app will feature different "pages" (fragments) that the user can switch between. Each fragment has a number of ImageButtons that, when clicked on, will play a sound. I put the following code first inside of the…
0
votes
1 answer

How to set an image view in to different screen sizes

In my app i used an image view ,i chose width and height as ,match_parent ,and fill_parent,but the image is still smaller than my screen size.What is wrong with this code.I know its a foolish question,i am new to android i want to fix this issue,can…
0
votes
1 answer

Imagebuttons won't align on the right next to eachother

I'm dynamically injecting rows in a container of a fragment. But I just can't seem to get the three image buttons aligned to the right, next to each other. Anyone an idea? Fragment layout:
RoadXY
  • 447
  • 4
  • 10
0
votes
1 answer

android java.langNullPointerException null object reference

I am trying to initialize all the navigation bar buttons and assign Black background color, when user clicks on one of the button, that one should change color and all other should remain Black. But i get the following error: Attempt to invoke…
Vaibhav Desai
  • 2,334
  • 2
  • 25
  • 29
0
votes
1 answer

How to add image buttons programmatically in rows and columns using android table layout

I am trying to create a table of images in Android. So i used table layout. The images will be added programmatically. Now the problem is when the image size varies, the table size also changing, sometimes making the table go beyond the screen. I…
0
votes
1 answer

How can I change ImageButton size from xml in java

I have a some problem in my android project. This is my xml code for ImageButton with fixed width and height.
0
votes
2 answers

How do I get the ID of the item of row (each row has 3 items) from a ListView, which contains a clickable items (imagebuttons)?

I read many articles about this problem in stackoverflow but I didn't solve my problem. I have ListView that have rows, each row has 3 imagebuttons, when I click at my imagebutton code in "setOnItemClickListener" doesn't work. I need which…
0
votes
1 answer

How to make 2 horizontal buttons to fill relative layout equally?

the corresponding xml layout:
ERJAN
  • 23,696
  • 23
  • 72
  • 146
0
votes
1 answer

Imagebutton with sound inside a Gridview

I am trying to create a gridView with ImageButtons inside them, so when pressed-a sound is emitted. So far I have my GridView_layout.xml, a layout for my button.xml. My gridAdapter to populate the grid with the buttons. With my current code the grid…
Noonmoon
  • 21
  • 2
  • 9
0
votes
2 answers

Android: deleting programmatically added image buttons with ID's

hows it going? I'm creating a little training app for a project, its going fine except for a formatting problem im getting. So, ive a csv file with a name and age for a client. an array is created from this, then I've got a scroll View containing a…
0
votes
4 answers

How to split android screen horizontal 2 vertical 3 total 6

Ok i am trying to split screen size to horizontally equally and vertically 3 each part Android studio on windows 8.1 api 9 Here image how i want each image is exactly those sizes and i want them to proportionally scaled according to the lower…
Furkan Gözükara
  • 22,964
  • 77
  • 205
  • 342
0
votes
1 answer

Android listview ImageButton onclick error

I use an imagebutton in a listview and everything was working fine. But when i tried to change the background resource on the imagebutton on its click i got my app crashed. here is my code. public View getView(final int position, View…
0
votes
1 answer

Add ImageButton dynamically from Database not displayed

I'm here today for my soundboard app ! son to make it simple i have a G_Son object which is the controller of the "Son" model. i get the list of sound from my database (everything is fine until here) but then when I dynamically try to create…
Bxtr
  • 316
  • 1
  • 13
0
votes
2 answers

Android : Image button has unwanted margin

I have some image buttons in my android project. but they have some gray margins like this pic(I take this pic from real device): How can I remove them?? I used this code but it doesn't have any effect. ib.setAdjustViewBounds(true); Image…
jion
  • 127
  • 13
0
votes
0 answers

How to handle touch events and click-events of a slidingUpPanelLayout and the elements inside of it

in my app I created a SlidingUpPanelLayout with inside a gridview of imagebuttons. The slidinguppanel is half hidden and when you swipe it up it becomes full visibile, when you swipe it down it becomes half hidden. When you tap on an imagebutton, it…
michoprogrammer
  • 1,159
  • 2
  • 18
  • 45