问题就创建包含按钮的画廊看法? [英] Question on creating a Gallery view containing buttons?

查看:90
本文介绍了问题就创建包含按钮的画廊看法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个包含按钮的画廊。

I created a Gallery that contains buttons.

例子code是如下:

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;
    }
}

画廊视图显示良好。问题是,这个画廊是不可滚动了。如果我在getView方法,画廊视图滚动以及与ImageView的替换按钮。那么,如何才能让含有按钮滚动画廊?

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?

感谢。

推荐答案

图库吃触摸事件。你不能把其中的任何交互式控件

Gallery eats touch events. You cannot put any interactive controls within it

这篇关于问题就创建包含按钮的画廊看法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆