Code example for ImageButton

Methods: setLayoutParamssetImageResource

    // create a new ImageView for each item referenced by the Adapter 
    public View getView(int position, View convertView, ViewGroup parent) {
        ImageButton buttonView;
        if (convertView == null) {  // if it's not recycled, initialize some attributes
        	buttonView = new ImageButton(mContext);
        	buttonView.setLayoutParams(new GridView.LayoutParams(130, 200 ));
        } else { 
        	buttonView = (ImageButton) convertView;
        return buttonView;
    // references to our images 
    private Integer[] mThumbIds = {
    		R.drawable.circulo, R.drawable.circulo, 
    		R.drawable.circulo, R.drawable.circulo 
Connect your IDE to all the code out there  Get Codota for Java