欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

andoid gallery点击事件添加

程序员文章站 2022-05-22 17:40:09
...
gallery.setSpacing(30);
gallery.setUnselectedAlpha(0.5f);
gallery.setOnItemClickListener(new OnItemClickListener()
        {

            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3)
            {
                /*
                 *  单机事件添加   对应画廊图片的点击事件
                 */
                switch (position)
                {
                    default:
                        Bundle instance = new Bundle();
                        instance.putIntArray("image_res", image_ids);
                        Intent intent = new Intent();
                        intent.setClass(ImageGallery.this, ViewFlipperActivity.class);
                        intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
                        intent.putExtras(instance);
                        startActivity(intent);
                        break;
                }
            }
           
        });
相关标签: gallery