Code example for ImageButton

Methods: setIdsetOnClickListenersetPaddingsetAdjustViewBoundssetImageResourcesetScaleType

0
     * @see android.widget.Adapter#getView(int, android.view.View, android.view.ViewGroup) 
     */ 
    public View getView(int position, View convertView, ViewGroup parent) {
    	ImageButton b;
    	if (convertView == null) {
    		b = new ImageButton(ctx);
    		b.setAdjustViewBounds(true);
    		b.setScaleType(ImageView.ScaleType.FIT_CENTER);
    		b.setPadding(20, 20, 20, 20);
    		b.setId(position);
    		b.setOnClickListener(new OnClickListener() {
    		    public void onClick(View v) {
    		        onButtonClicked((ImageButton) v);
    		    } 
    		}); 
    	} else { 
    		b = (ImageButton) convertView;
    	} 
    	b.setImageResource(mThumbIds[position]);
    	return b;
    } 
 
    /** 
     * Perform the button click action. 
Connect your IDE to all the code out there  Get Codota for Java