Question on creating a Gallery view containing buttons?
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 Butt开发者_运维问答on(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.
Gallery eats touch events. You cannot put any interactive controls within it
精彩评论