我怎么做一个刷卡动画从左至右过渡活动之间Monodroid?做一个、我怎么、动画、Monodroid

2023-09-05 03:22:37 作者:一粒已瞄准的子弹

我正在开发使用Monodroid,并希望能够向左或向右滑动并装入新的活动,我这样做。我也想有一个动画,显示下一个活动滑入屏幕,而其他滑出。

我已经试过OverridePendingTransition使用XML资源文件以及执行动画。这一切都不是但为我工作。有没有人有这样的成功?你可以在这里,而不是把你的code一个链接到一些博客或网站?

在我所有的活动,把这个在OnCreate中不起作用:

  this.OverridePendingTransition(Resource.Animation.slide_in_right,Resource.Animation.slide_out_left);
 

XML code:

幻灯片右:

 <设置的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android机器人:shareInterpolator =假>
<翻译
    机器人:时间=200
    机器人:fromXDelta =100%
    机器人:fromYDelta =0%
    机器人:toXDelta =0%
    机器人:toYDelta =0%/>
< /集>
 
Android 动画

滑出左:

 <设置的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android机器人:shareInterpolator =假>
<翻译
    机器人:时间=200
    机器人:fromXDelta =100%
    机器人:fromYDelta =0%
    机器人:toXDelta =0%
    机器人:toYDelta =0%/>
< /集>
 

我没有找到任何简单的code检测刷卡向左或向右的姿态。理想情况下,我想能够有两个功能:

  OnSwipeLeft()

OnSwipeRight()
 

然后,我会希望code是一个简单的动画(当然我知道我需要挂接到更多的使用这些功能:

  AnimateSlideLeft();

AnimateSlideRight();
 

解决方案

它出现在我的手机没有被启用,我不得不去的设置在我的Andr​​oid手机,使动画的动画。一旦我这样做,动画工作。要做到这一点,请单击Android设置按钮(在我的电话左下)。点击设置对话框。然后点击显示。然后点击动画。然后点击所有动画。一旦我这样做,一切工作。

I'm developing using Monodroid and want to be able to swipe left or right and load new activities as I do so. I also want to have an animation that shows the next activity slide into the screen while the other slides out.

I've tried OverridePendingTransition using XML resource files as well as implementing animations. None of this is working for me, however. Has anyone had success with this? Could you place your code here and not a link to some blog or website?

Putting this in OnCreate in all my activities does not work:

this.OverridePendingTransition(Resource.Animation.slide_in_right, Resource.Animation.slide_out_left);

XML code:

Slide in right:

<set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false" >
<translate
    android:duration="200"
    android:fromXDelta="100%"
    android:fromYDelta="0%"
    android:toXDelta="0%"
    android:toYDelta="0%" />
</set>

Slide out left:

<set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false" >
<translate
    android:duration="200"
    android:fromXDelta="100%"
    android:fromYDelta="0%"
    android:toXDelta="0%"
    android:toYDelta="0%" />
</set>

I haven't found any simple code to detect the gesture of swiping left or right. Ideally I'd like to be able to have two functions:

OnSwipeLeft()

OnSwipeRight()

And then I'd hope the code is a simple for animation (of course I Know I need to hook into more with these functions:

AnimateSlideLeft();

AnimateSlideRight();

解决方案

It appears animations were not enabled on my phone and that I had to go to the settings on my Android phone and enable animations. Once I did this, the animations worked. To do this, click on the Android settings button (in the lower left for my phone). Tap the "Settings" Box. Then tap "Display". Then tap "Animation". Then tap "All animations". Once I did this, everything worked.