首页 \ 问答 \ 如何扭转动画 - android(how to reverse an animation - android)

如何扭转动画 - android(how to reverse an animation - android)

我在android中有一个测试应用程序,并在其上显示TextView。 在左侧滑动我正在“动画”TextView离开屏幕。 我使用了以下代码:

RES /动画/ swipoff1

<?xml version="1.0" encoding="utf-8"?>
<set
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/linear_interpolator"
    android:fillAfter="true">
    <rotate xmlns:android="http://schemas.android.com/apk/res/android"
        android:fromDegrees="0"
        android:toDegrees="360"
        android:pivotX="50%"
        android:pivotY="50%"
        android:duration="500" >
    </rotate>

    <translate
        android:fromXDelta="0%p"
        android:toXDelta="75%p"
        android:duration="500" />
</set>

并在活动中

Animation swipe_off_1 = 
AnimationUtils.loadAnimation(getApplicationContext(), R.anim.swipoff1);

在左侧滑动:

dummy_textview.startAnimation(swipe_off_1);

在右侧滑动:

dummy_textview.clearAnimation();

我打算在右侧滑动时反转动画。

需要帮助来从代码中反转动画。


I have a test app in android and a TextView displayed on it. on a left swipe i am 'animating' that TextView off the screen. I have used the following code for that:

res/anim/swipoff1

<?xml version="1.0" encoding="utf-8"?>
<set
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/linear_interpolator"
    android:fillAfter="true">
    <rotate xmlns:android="http://schemas.android.com/apk/res/android"
        android:fromDegrees="0"
        android:toDegrees="360"
        android:pivotX="50%"
        android:pivotY="50%"
        android:duration="500" >
    </rotate>

    <translate
        android:fromXDelta="0%p"
        android:toXDelta="75%p"
        android:duration="500" />
</set>

and in the activity

Animation swipe_off_1 = 
AnimationUtils.loadAnimation(getApplicationContext(), R.anim.swipoff1);

on left swipe :

dummy_textview.startAnimation(swipe_off_1);

on right swipe :

dummy_textview.clearAnimation();

I plan to reverse the animation on right swipe.

need help to reverse the animation from code.


原文:
更新时间:2021-10-15 20:10

最满意答案

之前已经多次说过,但我只是因为我在商业规则行业(大学,而不是供应商)而再次说出来,业务规则正迅速成为任何IT开发的重要组成部分。

你的团队很可能会花费大量的金钱,时间和精力来重新发明轮子。 创建一个评估规则的代码通常不是问题。 而你似乎已经解决了它。 现在,您正面临着最具挑战性的部分:UI。

尽管所有的书都说最重要的业务规则是业务逻辑与主系统的分离,但我认为实际上拥有业务规则引擎的最重要的一点是让BUSINESS PEOPLE自己创建这些规则,没有打扰程序员。 这意味着一个可靠的UI。

有一些业务规则引擎具有出色的用户界面,可以完成您所需要的一切,并且可以更低效地实现这一目标。 其中一些是免费的或有免费选项。

Drools为例。 这是一个超级表演者。 但它只对程序员有用,除非你将Guvnor添加到图片中。 在Guvnor之前,Drools只在那些更关注评估性能和可用性的大公司中流行。

所以,在你自己构建规则UI这样一个可怕的项目之前,至少要看一些它们。 如果您使用的是Java平台,请考虑Drools。 您还可以查找位于MS Workflow Foundation内置的规则引擎之上的商业UI组件。 所有这些引擎都以XML格式保存规则,它们都具有很棒的UI(或UI组件),并且都是免​​费的或相对便宜的(除了InRule和BizTalk之外)。

我希望这可以帮助您节省团队即将体验的所有恶化和费用:)


It's been said many times before but I'm going to say it again simply because I am in business rules industry (university, not vendor) and business rules are quickly becoming very important part of any IT development.

It is very likely that your team will spend a lot of money, time and effort trying to reinvent the wheel. Creating a code that would evaluate your rules is not usually a problem. And you seem to solve it already. Now you are facing the most challenging part of it: the UI.

Even though all books say that the most important point of business rules is the separation of business logic from the main system, I'd say that practically the most important point of having business rules engine is to enable BUSINESS PEOPLE to create those rule themselves, without bothering programmers. That means a solid UI.

There are business rules engines with great user interfaces out there that do everything that you need, and they do that more efficiently for substantially less money. Some of them are free or have free option(s).

Take Drools, for example. It's a super performer. But it's useful only for programmers unless you add the Guvnor to the picture. Before the Guvnor, Drools was popular only among huge corporations that care more about evaluation performance then usability.

So, at least take a look at some of them before you undertake such a monstrous project of building rules UI yourself. Consider Drools if you are on Java platform. You can also look for commercial UI components that sit on top of the rule engine built into MS Workflow Foundation. All those engines save their rules in XML format, they all have great UI (or UI components), and all are either free or relatively cheap (except for maybe InRule and BizTalk.)

I do hope this helps you to save all that aggravation and expense that your team is about to experience :)

相关问答

更多
  • 你可能会检查出DBDesigner ... 现在称为MySQL Workbench http://dev.mysql.com/downloads/workbench/5.0.html You might check out DBDesigner ... Now known as MySQL Workbench http://dev.mysql.com/downloads/workbench/5.0.html
  • 我敢肯定,如果你在这里发布你的问题,人们会以一些有见地的观点跳到它上面。 我怀疑你真的可以开发一个可以做到这一点的程序......这取决于你正在构建的东西。 规范化不确定“好”的设计。 I'm sure if you posted your questions here people will jump on it with some insightful opinions. I doubt you can really develop a program that can do this... it re ...
  • 一些上下文:最近研究生院我研究了UML工具的可用性和一般的UML理解为一个独立的项目。 我也为生活建模/建筑师。 以前的帖子有太多的答案,没有足够的问题。 一个常见的误解是,UML是关于创建图表。 当然,图表很重要,但实际上你正在创建一个模型。 以下是每个供应商产品/解决方案比其他产品更好的一些事情应该回答的问题。 注意:列出的答案是我的观点,即使其他产品支持给定的功能或需要也是最好的。 你是建模还是绘画? (Drawing - ArgoUML ,免费的实现和Visio ) 你会在将来建模吗? (对于基本建 ...
  • NHibernate ? Linq (对sql)? 亚音速 ? Castle Project不做点什么吗? NHibernate? Linq (to sql)? Subsonic? doesn't Castle Project do something?
  • 好吧,这是一个简单的错误,虽然是一个非显而易见的错误,因为包构建部分访问代码正常并从我的提供程序程序集中调用它。 问题是,由于Web应用程序中的所有内容都以4.0框架为目标,因此我使用自定义提供程序代码添加的类库项目也是如此。 我不得不将目标框架设置为2.0,这一切都开始起作用了。 没有任何错误报告过于明显。 OK, this was a simple mistake, although a non-obvious one since the package building portion accesse ...
  • Sourcegraph for Haskell为您提供了Haskell代码的图形化表示。 看看文档 ,有一些例子。 Sourcegraph for Haskell gives you a graphical rapresentation of Haskell Code. Take a look at the documentation, there are some examples.
  • 缺乏做其他事情的特殊原因,您通常使用MFC本身 - CDC::Polyline , CDC::PolyPolyline , CDC::Arc , CDC::PolyBezier等。 编辑:我担心如果你想要一个矢量绘图程序的完整例子,完成缩放,编辑,保存和打开文件等等,你可能在错误的地方。 我(以及其他一些人)可以而且经常会回答相应的具体问题,但如果你想要相对较大,精心设计的程序的例子,像Code Project这样的地方可能是更好的选择。 我不确定他们有一个,但至少在那里你有一个合理的机会。 关于最接近的我 ...
  • 我觉得你的问题与DexExpress eXpressApp Framework的设计和建模重复。 基本上,您将能够使用内置的Visual Studio建模工具对单个域组件进行建模。 它适用于接口。 也许,您还可以基于开源Liekhus ADO.NET实体数据模型XAF扩展工具构建自定义建模解决方案。 最后,由于您正在使用XAF(我相信您也是DevExpress客户),我建议您联系我们的支持团队,以获得有关XAF或任何其他DevExpress产品的快速且有保障的帮助。 I felt that your que ...
  • 请参阅本教程 它一定会帮到你。 恩乔伊! Please see this tutorial It will definitely help you. Njoy!!
  • 之前已经多次说过,但我只是因为我在商业规则行业(大学,而不是供应商)而再次说出来,业务规则正迅速成为任何IT开发的重要组成部分。 你的团队很可能会花费大量的金钱,时间和精力来重新发明轮子。 创建一个评估规则的代码通常不是问题。 而你似乎已经解决了它。 现在,您正面临着最具挑战性的部分:UI。 尽管所有的书都说最重要的业务规则是业务逻辑与主系统的分离,但我认为实际上拥有业务规则引擎的最重要的一点是让BUSINESS PEOPLE自己创建这些规则,没有打扰程序员。 这意味着一个可靠的UI。 有一些业务规则引擎具 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)