如何禁用库视图滚动视图

2023-09-07 02:44:13 作者:Dimple「酒窝」

喜 我想禁用图库查看滚动的时候,我们选择在画廊查看特定项目。\ 我怎么做。好心帮我出。

hi i want to disable gallery view scrolling when we select particular item in gallery view.\ how do i do that. kindly help me out.

推荐答案

编写扩展库你自己的画廊类。像这样重写onFling方式:

Write your own gallery class that extends Gallery. Override the onFling method with something like this :

public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY){
if (itemIsSelected)
    return true;
else return super.onFling(e1, e2, velocityX, velocityY);
}

设置的itemIsSelected标志的onItemClickListener。

set the the itemIsSelected flag in your onItemClickListener.

希望有所帮助。