2010-08-24 14 views
1

Hai All, 我有一个包含电影,音乐,游戏,杂志等文字值的图库,我的问题是,无论何时用户滚动图库,我想获得元素的位置。如何在用户滚动时获取图库中元素的位置?

对于实例, 用户从电影滚动画廊到游戏意味着,那么我必须得到当前选定元素的位置,即游戏的位置。

由于事先

+0

请在库控制 HTTP我的博客文章: //android-pro.blogspot.com/2010/07/android-gallery-control.html它可以帮助你 – 2010-08-24 11:15:26

回答

0

在你的OnCreate做财产以后这样.....

{ 
gallery.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { 

      public void onItemSelected(AdapterView<?> arg0, View arg1, int pos ,long arg3) { 

       //you will have the selected position in variable pos 
       } 

} 

希望它会工作

相关问题