获取当前图像的照片显示的位置 [英] Get the position of the current image displayed in Gallery
问题描述
在我的申请,我有图片的画廊,
但我想检测当前图像显示的位置,
例如:当我启动我的acvitivity,该位置为0,但是当我在滚动我的画廊,我想显示当前图像的位置,
我试图OnFocusChanged,OnItemClicked,但只有当我点击我的图片库中的项目
任何想法! :(
gal.setOnItemSelectedListener(新OnItemSelectedListener(){
@覆盖
公共无效onItemSelected(适配器视图<>母公司视图中查看,
INT位置,长的id){
//做些什么位置
}
};
您每次在画廊的新项目被放置在中心的时间得到这个回调,所以要小心不要做任何工作密集的,因为如果用户滚动快,你会得到一个回调,因为他们通过每个项目。
in my application , i have a gallery of pictures,
but i want to detect the position of the current image displayed ,
For example : when i launch my acvitivity, the position is 0, but when i scroll in my gallery,i want to get The position of the Current image displayed ,
i have tried OnFocusChanged , OnItemClicked , but that works only if i click on an item of my gallery
Any ideas ! :(
gal.setOnItemSelectedListener(new OnItemSelectedListener(){
@Override
public void onItemSelected(AdapterView<?> parent, View view,
int position, long id) {
//Do something with position
}
};
You get this callback every time a new item in the gallery gets put in the center, So be careful not to do anything to work intensive because if the user scrolls fast you are going to get a callback for each item they pass.
这篇关于获取当前图像的照片显示的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!