Best code examples for Android ImageButton class (android.widget.ImageButton)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ImageButton class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Related Android ImageButton Questions & Answers:
Other Android ImageButton Examples
15:	public class MainActivity extends Activity {
16:	
17:		ImageButton btnSwitch;
18:	
19:		private Camera camera;
-
29:	
30:			// flash switch button
31:			btnSwitch = (ImageButton) findViewById(R.id.btnSwitch);
32:	
33:	}

Read More

19:	
20:		private ImageButton btnPlay;
21:		private ImageButton btnForward;
22:		private ImageButton btnBackward;
23:		private ImageButton btnNext;
-
20:		private ImageButton btnPlay;
21:		private ImageButton btnForward;
22:		private ImageButton btnBackward;
23:		private ImageButton btnNext;
24:		private ImageButton btnPrevious;
-
21:		private ImageButton btnForward;
22:		private ImageButton btnBackward;
23:		private ImageButton btnNext;
24:		private ImageButton btnPrevious;
25:		private ImageButton btnPlaylist;
-
22:		private ImageButton btnBackward;
23:		private ImageButton btnNext;
24:		private ImageButton btnPrevious;
25:		private ImageButton btnPlaylist;
26:		private ImageButton btnRepeat;
-
23:		private ImageButton btnNext;
24:		private ImageButton btnPrevious;
25:		private ImageButton btnPlaylist;
26:		private ImageButton btnRepeat;
27:		private ImageButton btnShuffle;
-
24:		private ImageButton btnPrevious;
25:		private ImageButton btnPlaylist;
26:		private ImageButton btnRepeat;
27:		private ImageButton btnShuffle;
28:		private SeekBar songProgressBar;
-
25:		private ImageButton btnPlaylist;
26:		private ImageButton btnRepeat;
27:		private ImageButton btnShuffle;
28:		private SeekBar songProgressBar;
29:		private TextView songTitleLabel;
-
26:		private ImageButton btnRepeat;
27:		private ImageButton btnShuffle;
28:		private SeekBar songProgressBar;
29:		private TextView songTitleLabel;
30:		private TextView songCurrentDurationLabel;
-
50:			// All player buttons
51:			btnPlay = (ImageButton) findViewById(R.id.btnPlay);
52:			btnForward = (ImageButton) findViewById(R.id.btnForward);
53:			btnBackward = (ImageButton) findViewById(R.id.btnBackward);
54:			btnNext = (ImageButton) findViewById(R.id.btnNext);
-
51:			btnPlay = (ImageButton) findViewById(R.id.btnPlay);
52:			btnForward = (ImageButton) findViewById(R.id.btnForward);
53:			btnBackward = (ImageButton) findViewById(R.id.btnBackward);
54:			btnNext = (ImageButton) findViewById(R.id.btnNext);
55:			btnPrevious = (ImageButton) findViewById(R.id.btnPrevious);
-
52:			btnForward = (ImageButton) findViewById(R.id.btnForward);
53:			btnBackward = (ImageButton) findViewById(R.id.btnBackward);
54:			btnNext = (ImageButton) findViewById(R.id.btnNext);
55:			btnPrevious = (ImageButton) findViewById(R.id.btnPrevious);
56:			btnPlaylist = (ImageButton) findViewById(R.id.btnPlaylist);
-
53:			btnBackward = (ImageButton) findViewById(R.id.btnBackward);
54:			btnNext = (ImageButton) findViewById(R.id.btnNext);
55:			btnPrevious = (ImageButton) findViewById(R.id.btnPrevious);
56:			btnPlaylist = (ImageButton) findViewById(R.id.btnPlaylist);
57:			btnRepeat = (ImageButton) findViewById(R.id.btnRepeat);
-
54:			btnNext = (ImageButton) findViewById(R.id.btnNext);
55:			btnPrevious = (ImageButton) findViewById(R.id.btnPrevious);
56:			btnPlaylist = (ImageButton) findViewById(R.id.btnPlaylist);
57:			btnRepeat = (ImageButton) findViewById(R.id.btnRepeat);
58:			btnShuffle = (ImageButton) findViewById(R.id.btnShuffle);
-
55:			btnPrevious = (ImageButton) findViewById(R.id.btnPrevious);
56:			btnPlaylist = (ImageButton) findViewById(R.id.btnPlaylist);
57:			btnRepeat = (ImageButton) findViewById(R.id.btnRepeat);
58:			btnShuffle = (ImageButton) findViewById(R.id.btnShuffle);
59:			songProgressBar = (SeekBar) findViewById(R.id.songProgressBar);
-
56:			btnPlaylist = (ImageButton) findViewById(R.id.btnPlaylist);
57:			btnRepeat = (ImageButton) findViewById(R.id.btnRepeat);
58:			btnShuffle = (ImageButton) findViewById(R.id.btnShuffle);
59:			songProgressBar = (SeekBar) findViewById(R.id.songProgressBar);
60:			songTitleLabel = (TextView) findViewById(R.id.songTitle);
-
57:			btnRepeat = (ImageButton) findViewById(R.id.btnRepeat);
58:			btnShuffle = (ImageButton) findViewById(R.id.btnShuffle);
59:			songProgressBar = (SeekBar) findViewById(R.id.songProgressBar);
60:			songTitleLabel = (TextView) findViewById(R.id.songTitle);
61:			songCurrentDurationLabel = (TextView) findViewById(R.id.songCurrentDurationLabel);

Read More

15:	public class MainActivity extends Activity {
16:	
17:		ImageButton btnSwitch;
18:	
19:		private Camera camera;

Read More

ImageButton Class Overview
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." For example:Save the XML file in your project res/drawable/ folder and then reference it as a drawable for the source of your ImageButton (in the android:src attribute). Android will automatically change the image based on the state of the button and the corresponding images defined in the XML.The order of the elements is important because they are evaluated in order. This is why the "normal" button image comes last, because it will only be applied after android:state_pressed and android:state_focused have both evaluated false.See the Buttons gui...
Methods