2013-03-05 60 views
0

我希望有一个自定义动画的一个活动,我用这样的代码:自定义活动的动画,找不到@阿尼姆/资源

<style name="WCCAnimation.LoadingImageShow" parent="@android:style/Animation.Activity"> 
    <item name="android:activityOpenEnterAnimation">@anim/zoom_enter</item> 
    <item name="android:activityCloseExitAnimation">@anim/slide_out_left</item> 
</style> 

但问题是,Eclipse显示:

error: Error: No resource found that matches the given name (at 'android:activityCloseExitAnimation' with value '@anim/slide_out_left').

我确定slide_out_left.xml文件位于sdk的anim文件夹中。

我在anim文件夹下试了一下其他的动画,还是不行。


我只要按照答案this的情况下,但对我来说,只是找不到下@anim资源。 @android:anim/slide_out_right

回答

0

如果

slide_out_left.xml file is in sdk's anim folder

正如你提到的,然后像Android这样的资源提供路径。

请注意,并非平台文件中的所有资源均可用于您的应用程序,有时您可能需要将精确的xml复制到您的应用程序。

+0

当我将此文件复制到我自己的文件夹时,文件的这一行:slide_out_left.xml有错误:错误:无效的开始标记 集 – Vigor 2013-03-05 06:27:52

+0

您是否将它放置到anim文件夹?你能指定确切的平台你从你的项目平台级别复制动画文件吗?其实,标签应该没问题 - http://developer.android.com/guide/topics/resources/animation-resource.html。 – sandrstar 2013-03-05 06:34:37

+0

我把它放在style文件夹中,我使用@ style /来导入它。我认为问题不在于此。我发现其他人可以使用@ anim/xxx没有任何问题。顺便说一句,谢谢你的回答。 – Vigor 2013-03-05 06:47:56

0

在布局中使用您要为其生成动画的代码。并将缩放或Alpha效果应用于动画xml。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layoutAnimation="@anim/zoom_enter" 
    android:orientation="vertical" >