开发者

Android - How to prevent a user interacting with Gallery

OK, I know this questions sounds weird at first, as GALLERY is designed to be user interactive, but, I like the Gallery functionali开发者_运维问答ty, as it suits a lot of my needs. i.e. I can give it a number of pictures, move the whole of them from right to left, or left to right and get them an animate (in my case, zoom) when one of them is selected. So all good.

I just need to do the selection programatically, which I currently have working. I just don't want the user to be able to fling, scroll, select, longpress, etc. by themselves. So no user interaction is required.

So, how can I prevent a user from doing theses things, without writting a gallery function myself (and without chopping a users fingers off!).

Thanks.


Try setting the clickable and focusable properties of your Gallery View to false.


Following worked for me:

Gallery gallery = new Gallery( ctx ) {
    @Override
    public boolean onTouchEvent(MotionEvent event) {
        return true;
    }
};

If some interaction is still left you can also try:

Gallery dotList = new Gallery( ctx ) {
    @Override
    public boolean onTouchEvent(MotionEvent event) {
        return true;
    }

    @Override
    public boolean onSingleTapUp(MotionEvent e) {
        return true;
    }

    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
        return true;
    }
};
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜