Pooja Roy
Pooja Roy

Reputation: 545

Error in Sequential Animation XML

I am using animation in that. I am getting compile time Error in Using sequential Animation.

The error is:

Multiple annotations found at this line:
    - error: No resource identifier found for attribute 'pivotX' in package 
     'android '
    - error: No resource identifier found for attribute 'fromXScale' in package 
     'android '
    - error: No resource identifier found for attribute 'toXScale' in package 
     'android '
    - error: No resource identifier found for attribute 'toYScale' in package 
     'android '
    - error: No resource identifier found for attribute 'duration' in package 
     'android '
    - error: No resource identifier found for attribute 'fromYScale' in package 
     'android '
    - error: No resource identifier found for attribute 'pivotY' in package 
     'android '

And My xml Code is:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android "
    android:fillAfter="true"
    android:interpolator="@android:anim/linear_interpolator" >

    <scale
        xmlns:android="http://schemas.android.com/apk/res/android "
        android:duration="1000"
        android:fromXScale="1"
        android:fromYScale="1"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="3"
        android:toYScale="3" >
    </scale>


    <scale
        xmlns:android="http://schemas.android.com/apk/res/android "
        android:duration="1000"
        android:fromXScale="1.0"
        android:fromYScale="1.0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="0.5"
        android:toYScale="0.5" >
    </scale>

</set>

Can anyone tell me why it is cause of ?

Upvotes: 1

Views: 1669

Answers (2)

Dig
Dig

Reputation: 234

Just replace below line everywhere

xmlns:android="http://schemas.android.com/apk/res/android "

with

xmlns:android="http://schemas.android.com/apk/res/android"

There is extra white space at end.

EDIT : For AnimationListener

Write this in onWindowFocusChanged()

Animation anim_translate = AnimationUtils.loadAnimation(
                    HomeScreenActivity.this, R.anim.translate);
img_main.startAnimation(anim_translate);

anim_translate.setAnimationListener(new AnimationListener() {

                @Override
                public void onAnimationStart(Animation animation) {
                }

                @Override
                public void onAnimationRepeat(Animation animation) {
                }

                @Override
                public void onAnimationEnd(Animation animation) {
                    // start another activity
                }
            });

Upvotes: 1

Digvesh Patel
Digvesh Patel

Reputation: 6533

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" **<----- remove space**
    android:fillAfter="true"
    android:interpolator="@android:anim/linear_interpolator" >

    <scale
        xmlns:android="http://schemas.android.com/apk/res/android "
        android:duration="1000"
        android:fromXScale="1"
        android:fromYScale="1"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="3"
        android:toYScale="3" >
    </scale>


    <scale
        xmlns:android="http://schemas.android.com/apk/res/android "
        android:duration="1000"
        android:fromXScale="1.0"
        android:fromYScale="1.0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="0.5"
        android:toYScale="0.5" >
    </scale>

Upvotes: 3

Related Questions