与刷卡水平和垂直方向动态视图视图、方向、动态、水平和

2023-09-05 11:00:53 作者:闹哪样

请检查上述观点

我必须相应地创建一个视图,在那里当我们滑块向左向右的图像会一样从右到左。当我滑动上下Web视图会及滑动底部到顶部的图像会来。像所有的图像和网页URL的数据将是动态的,数据将来自于服务器。此外,我要申请拉刷新的概念在里面。

I have to create a view accordingly, where when we slide left to right images will come same as right to left. When I slide top to bottom a web view will come and sliding bottom to top images will come. All the data like images and web url will be dynamic and data will come from server. Also I have to apply pull to refresh concept in it.

我已经经历这个链接了,并成功地实现了它,但它不是相应的,它有很多限制。

I have gone through this link and successfully implemented it but its not accordingly and it have many limitations.

请让我知道,如果这种说法是可以或不可以。

Please let me know that if this kind of view is possible or not.

推荐答案

有一种方法使用任何LIB与出要做到这一点。

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

在XML文件中设计另一个布局,并把所有你想显示在后滑动的时间窗口小部件应用滑动动画一样从左到右,从上到下,只要你想。之后,手势探测器的帮助下,你可以滑动的情况下,并执行你的任务。

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.

下面是我的code

Animation Left slide
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="500"
    android:fromXDelta="100%"
    android:toXDelta="0%" >
</translate>

Animation Right slide
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="500"
    android:fromXDelta="-100%"
    android:toXDelta="0%" >
</translate>

Animation Slide up
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="500"
    android:fromYDelta="100%"
    android:toYDelta="0%" >
</translate>

Animation Slide Down
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="500"
    android:fromYDelta="-100%"
    android:toYDelta="0%" >
</translate>

在类文件用于动画code

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;
 
精彩推荐
图片推荐