tags:

views:

58

answers:

0

I created a Gallery that contains buttons.

Example code is below:

public class Adapter extends BaseAdapter {
    private Context mContext;

    public ImageAdapter(Context c) {
        mContext = c;
    }

    public int getCount() {
        return 10;
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        Button but = new Button(mContext);
        return but;
    }
}

The gallery view is displayed well. The problem is that this gallery is not scrollable any more. If I replace Button with ImageView in the getView method, the gallery view scroll well. Then, how can I make the gallery containing buttons to scroll?

Thanks.