Questions tagged [imagebutton]

An image button is a button that displays an image, regardless of platform

An image button is a button that displays an image, regardless of platform

1801 questions
14
votes
1 answer

Android buttonimage shake animation

I am new with android and im looking for a way to shake my buttonimage on click. I got this so far but it crashes all the time. Or if you click it nothing works. I hope you people can help me out. if i forgot anythiing just say it. code can be…
The M
  • 641
  • 1
  • 7
  • 33
13
votes
2 answers

How can I change the images on an ImageButton in Android when using a OnTouchListener?

I have the following code which creates an ImageButton and plays a sound when clicked: ImageButton SoundButton1 = (ImageButton)findViewById(R.id.sound1); SoundButton1.setImageResource(R.drawable.my_button); SoundButton1.setOnTouchListener(new…
codeman
  • 8,868
  • 13
  • 50
  • 79
13
votes
8 answers

How to disable submit behaviour of asp:ImageButton?

I have a image button in a page which can be triggered on mouse click, by default it gets triggered on enter press also which i want to disable. I know about "UseSubmitBehaviour" attribute in asp:Button, is there a way to do the same in…
Manish Basantani
  • 16,931
  • 22
  • 71
  • 103
13
votes
5 answers

Android ImageButton background color

I have an ImageButton with a background image that has some transparency. By default, the button gets a grey background where the transparency pixels are - due to the Holo.Light theme. I tried setting the background color of the button to…
Ayyoudy
  • 3,641
  • 11
  • 47
  • 65
12
votes
6 answers

png image showing up with grey background in android

I have some png image buttons that I use in my app. But they are showing up with grey backgrounds on my page. Does android always show a grey background for a transparent one? Is there a work around? This is how it showed before. This is how it…
Brahadeesh
  • 2,245
  • 8
  • 40
  • 58
12
votes
3 answers

How to create image button in android?

So I'm new to android development...How can I create an image that acts like button, so when I press that image, image starts a specific activity. So I want this to show as image:
11
votes
2 answers

Android - automatic overlay touch down / highlighted imagebutton states

Is it possible using an ImageButton to have touch down and highlighted states, without the need for 2 more image resources on Android (6 more, considering h/m/ldpi)? I'm basically looking for behavior similar to iOS where the OS can put an…
Codz
  • 315
  • 1
  • 2
  • 10
11
votes
4 answers

svg image as button in flutter

I created a play-button and saved it as a svg dokument. I have also created my home screen with a picture in the background and a floatingActionButton centered. (I used stack for this). import 'package:flutter/material.dart'; class…
J.W
  • 1,135
  • 4
  • 13
  • 21
11
votes
3 answers

Change viewpager fragment by a buttonClick

I'm trying to change the viewpager fragment by clicking on a button. I have 5 fragments, each fragment has it's own xml file (frag1.xml, frag2.xml, and so on). Every fragment has it's 5 buttons that should go to other pages of the viewpager. But the…
mXX
  • 3,595
  • 12
  • 44
  • 61
11
votes
8 answers

how can i resize imageButton?

I want to resize my ImageButton using mouse on graphic layout or using code by android:layout_width , android:layout_height. But whenever I do this, the ImageButton isn't resized, in fact and it's not smaller but it is cut at the edges. thanks in…
eng.ahmed
  • 905
  • 4
  • 16
  • 38
11
votes
1 answer

Android: How to write multiple selectors in a single xml file

In my application,I have 4 ImageButtons and each ImageButton have different source image based on their states.So maintaining 4 separate xml files for each of the button. Is there any way to write all the selectors in a single xml file ?
Dileep Perla
  • 1,865
  • 7
  • 33
  • 54
10
votes
16 answers

asp:ImageButton not firing onclick event

I have a page that uses a master page, several RequiredFieldValidators, and the Web Toolkit autocomplete extender. The following code only shows the bare minimum of the page: <%@ Page Language="C#" AutoEventWireup="true" …
cdonner
  • 37,019
  • 22
  • 105
  • 153
10
votes
7 answers

ImageButton does not display a particular drawable

This is rather a funny problem I have ever come across, I have a table layout with 9 image buttons, 3 per row. Every ImageButton has a different image associated with it. I have set the background of the image button to transparent (#00000000). Now…
Ragunath Jawahar
  • 19,513
  • 22
  • 110
  • 155
10
votes
1 answer

What should I use ImageButton or Button?

i have a button with two states(selected and unselected). the image of button is different for the states. Which one should I use? How do i set images and states? Please give suggestions(i am new to android).
xydev
  • 3,409
  • 5
  • 34
  • 54
10
votes
4 answers

Android ImageButton - determine what resource is currently set

Is there a way I can find what resource a particular ImageButton is set to, at any given time? For eg: I have an ImageButton that I set to R.drawable.btn_on onCreate. Later, at some point, the ImageButton gets set to R.drawable.btn_off. I want to be…
Chris
  • 3,787
  • 13
  • 42
  • 49