Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error:(3) Error parsing XML: not well-formed (invalid token)

Tags:

android

xml

This is my xml file inside then anim folder. When I run the app then an error in parsing is shown.

shake.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
< translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="1000"
    android:fromXDelta="0%"
    android:interpolator="@anim/cycle_7"
    android:toXDelta="5%" />
</set>

cycle_7.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
< cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
    android:cycles="7" />
</set>
like image 322
arps Avatar asked Dec 31 '15 07:12

arps


1 Answers

IT People Always Welcome Here you find full code that you are looking for.

shake.xml

<translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromXDelta="0%" android:toXDelta="5%" android:duration="1000" android:interpolator="@anim/cycle_7" />

cycle_7.xml

<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android" android:cycles="7" />

How to Use:

private void showError() {
      Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
      mEditText.startAnimation(shake);
}

Edited:

  1. I think You have space between < and translate if you have copied code. Check it out.
  2. <set> is not required as i have run demo with my above code its working fine.

Thank you. May this will helpful you.

like image 83
Pratik Butani Avatar answered Nov 07 '22 16:11

Pratik Butani