如何在左右滑动图像?

时间:2015-02-24 10:08:41

标签: android swipe-gesture

我想在触摸每张图片时更改图像。 总图像数= 3,其中网址存储在url []中,但我的问题是它只是在两个图像之间滑动。

holder.llRecommendation.setOnTouchListener(new SwipeDismissTouchListener(
                     holder.llRecommendation,
                     null,
                     new SwipeDismissTouchListener.DismissCallbacks() {
                         @Override
                         public boolean canDismiss(Object token) {
                             return true;
                         }

                         @Override
                         public void onDismiss(View view, Object token) {



                                 if(touch>0)
                                    {


                                          touch--;
                                            loader.displayFullImage(url[touch], holder.imgRecommendationBelow);
                             }


                                 else if(touch<2)
                                    {



                                          touch++;
                                            loader.displayFullImage(url[touch], holder.imgRecommendationBelow);
                                    }

                              /*Toast.makeText(mParentActivity, ""+SwipeDismissTouchListener.touch, Toast.LENGTH_SHORT).show ();                    

                                loader.displayFullImage(url[SwipeDismissTouchListener.touch], holder.imgRecommendationBelow);*/
                            // dismissableContainer.removeView(dismissableButton);
                         }
                     }));

0 个答案:

没有答案