1

在预蜂窝版本中会引发以下错误。我的应用程序中的错误日志显示如下:

07-06 11:48:32.563: E/AndroidRuntime(433): java.lang.NoSuchMethodError: android.widget.TextView.getTranslationY
07-06 11:48:32.563: E/AndroidRuntime(433):  at com.quickreturntopanimation.AnimationFragment$2.onScroll(AnimationFragment.java:135)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.widget.AbsListView.invokeOnItemScrollListener(AbsListView.java:675)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.widget.AbsListView.trackMotionScroll(AbsListView.java:2956)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.widget.AbsListView.onTouchEvent(AbsListView.java:2065)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.widget.ListView.onTouchEvent(ListView.java:3315)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.view.View.dispatchTouchEvent(View.java:3766)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:897)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
07-06 11:48:32.563: E/AndroidRuntime(433):  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1671)
07-06 11:48:32.563: E/AndroidRuntime(433):  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.app.Activity.dispatchTouchEvent(Activity.java:2086)
07-06 11:48:32.563: E/AndroidRuntime(433):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1655)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1785)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.os.Looper.loop(Looper.java:123)
07-06 11:48:32.563: E/AndroidRuntime(433):  at android.app.ActivityThread.main(ActivityThread.java:4627)
07-06 11:48:32.563: E/AndroidRuntime(433):  at java.lang.reflect.Method.invokeNative(Native Method)
07-06 11:48:32.563: E/AndroidRuntime(433):  at java.lang.reflect.Method.invoke(Method.java:521)
07-06 11:48:32.563: E/AndroidRuntime(433):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-06 11:48:32.563: E/AndroidRuntime(433):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-06 11:48:32.563: E/AndroidRuntime(433):  at dalvik.system.NativeStart.main(Native Method)

此行中显示错误:

if(mQView.getTranslationY() != 0) {

任何帮助表示赞赏............在此先感谢

4

2 回答 2

0

那个函数在 Honeycomb 之前是不存在的,所以你不能调用它。您需要找到一种不调用该函数的方法。

于 2013-07-06T12:05:41.270 回答
0

您可能想要使用 NineOldAndroid。根据其文档

NineOldAndroid 库包含 Android 3.0 引入的几乎所有新属性的兼容性实现,允许您执行适用于每个 API 级别的非常复杂的动画。

你可以在这里找到它 -> NineOldAndroid

于 2014-02-14T14:30:55.363 回答