2013-03-05 50 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" >