سؤال

I have a view animator that has a lot Button on it. I've a OnTouchEvent for the view . codes works fine if I touch on space, but if I touch the button the code doesn't work. how can i fix it?

 final View frame = (View)findViewById(R.id.viewAnimator1);

    frame.setOnTouchListener(new OnSwipeTouchListener() {

         public void onSwipeRight() {   

            viewAnimator.showPrevious();

             }                      
        public void onSwipeLeft() {

             viewAnimator.showNext();
                    }}
هل كانت مفيدة؟

المحلول

You need to set on click listener for buttons, if all of them makes the same work, you can extend button class and implement on click listener and use it instead of normal button

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top