问题就创建包含按钮的画廊看法?画廊、按钮、看法、问题

由网友(最美不过初遇见)分享简介:我创建了一个包含按钮的画廊。I created a Gallery that contains buttons.例子code是如下:public class Adapter extends BaseAdapter {private Context mContext;public ImageAdapter(Cont...

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

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

阅读全文

相关推荐

最新文章