Dynamic view with swiping horizontally and vertically

后端 未结 2 1049
广开言路
广开言路 2020-12-30 16:18

\"enter

Please check above view

I have to create a view accordingly, where wh

2条回答
  •  梦谈多话
    2020-12-30 16:49

    There is a way to do this with out using any lib.

    In your xml file design another layout and put all the widget which you want to show at the time of sliding after that apply sliding animation like left to right and up to down as you want. After that with the help of gesture detector you can get the event of sliding, and perform your task.

    Here is my code

    Animation Left slide
    
    
    
    Animation Right slide
    
    
    
    Animation Slide up
    
    
    
    Animation Slide Down
    
    
    

    Code used in class file for animation

    case SimpleGestureFilter.SWIPE_RIGHT:
        ScreenAnimation.setVisibility(View.VISIBLE);
        ScreenAnimation.startAnimation(RightSwipe);
    
        break;
    case SimpleGestureFilter.SWIPE_LEFT:
        ScreenAnimation.setVisibility(View.VISIBLE);
        break;
    case SimpleGestureFilter.SWIPE_DOWN:
        ScreenAnimation.setVisibility(View.VISIBLE);
        ScreenAnimation.startAnimation(DownSwipe);
        break;
    case SimpleGestureFilter.SWIPE_UP:
        ScreenAnimation.setVisibility(View.VISIBLE);
        ScreenAnimation.startAnimation(UpSwipe);
        break;
    

提交回复
热议问题