android– 刷卡时使页面更改动画

android– 刷卡时使页面更改动画,第1张

概述我有一个应用程序,我使用SimpleGestureFilter.java,它的作用是在刷卡上调用正确的功能(左右双击……等)这里是代码的一部分@OverridepublicbooleandispatchTouchEvent(MotionEventme){//CallonTouchEventofSimpleGestureFilterclassthis.de

我有一个应用程序,我使用SimpleGestureFilter.java,它的作用是在刷卡上调用正确的功能(左右双击……等)这里是代码的一部分

     @OverrIDe    public boolean dispatchtouchEvent(MotionEvent me){        // Call ontouchEvent of SimpleGestureFilter class         this.detector.ontouchEvent(me);       return super.dispatchtouchEvent(me);    }    public voID onSwipe(int direction) {      String str = "";      switch (direction) {      case SimpleGestureFilter.SWIPE_RIGHT : minusOne(); str = "Swipe Right";                                               break;      case SimpleGestureFilter.SWIPE_left : plusOne(); str = "Swipe left";                                                     break;      }     }

所以我想在plusOne()被解析时或者其他一些函数执行某些 *** 作并且它在同一个MainActivity.java类上提交意图时,我试图在该事件恰好看起来像书页幻灯片时实现,要在屏幕之间进行一些转换,它只是一个MainActivity屏幕

      Intent i = new Intent(this,MainActivity.class);  i.putExtra(DBAdapter.KEY_pk_ymd, Integer.parseInt(dt));  startActivityForResult(i,ACTIVITY_EDIT);

解决方法:

使用:push_left_in.xml

 <?xml version="1.0" enCoding="utf-8"?><set xmlns:androID="http://schemas.androID.com/apk/res/androID"androID:interpolator="@androID:anim/accelerate_interpolator">     <translate androID:fromXDelta="100%p" androID:toXDelta="0" androID:duration="300"/>  <Alpha androID:fromAlpha="0.0" androID:toAlpha="1.0" androID:duration="300" />  

和push_left_out.xml

<?xml version="1.0" enCoding="utf-8"?><set xmlns:androID="http://schemas.androID.com/apk/res/androID"androID:interpolator="@androID:anim/accelerate_interpolator"><translate androID:fromXDelta="0" androID:toXDelta="-100%p" androID:duration="300"/>    <Alpha androID:fromAlpha="1.0" androID:toAlpha="0.0" androID:duration="300" /></set>

所有xml都位于res / anim中,并且像这样调用

    Intent i = new Intent(this,MainActivity.class);             startActivityForResult(i,ACTIVITY_EDIT);    overrIDePendingTransition(R.anim.push_left_in,R.anim.push_left_out);    
总结

以上是内存溢出为你收集整理的android – 刷卡时使页面更改动画全部内容,希望文章能够帮你解决android – 刷卡时使页面更改动画所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1107101.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存