The item must be declared an error for the tag form.

I am using Android Studio I / O (Preview) 0.3.2

I use this example to determine the background gradient in my application. I get Element must be declared error. enter image description here

I checked and I will not find any solutions. Can someone help me how can I declare this tag in xml

+51
android gradle
Dec 26 '13 at 20:13
source share
6 answers

This problem was caused by my XML file. My XML file with the gradient was in the values folder, I solved this problem by moving the gradient file to the drawable folder

+88
Dec 26 '13 at 20:52
source share

You can just right click

Res

and press

New

to create

Android Resource File

and select

Resource type

be

Drawable

and change all defaults

root element

to

the form

Yes, this is just buggy in Android Studio to create a new XML file different from layout and lol values.

Hope this helps you!

+16
Jun 07 '15 at 20:56
source share

I had the same problem with Android Studio, I created the "anim" directory under "res", and then copied the xml file to the one after which the error disappeared.

+15
Feb 02 '15 at 6:53
source share

You need to use the selector inside the <set/> tags, for example:

 <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="true" android:state_pressed="true"> <objectAnimator android:duration="@android:integer/config_shortAnimTime" android:propertyName="translationZ" android:valueTo="15dp" android:valueType="floatType" /> </item> <item> <objectAnimator android:duration="@android:integer/config_shortAnimTime" android:propertyName="translationZ" android:valueTo="5dp" android:valueType="floatType" /> </item> </selector> </set> 
+9
Apr 21 '16 at 19:22
source share

Had a similar problem with the selector tag used to create the state list animator.

My animation was in the animation resource folder. I had to transfer it to the animator folder.

+6
Apr 21 '16 at 17:56 on
source share

In this example, I think that if you add the xmlns:android attribute (inside the form tag, as in the example you are using), it will work:

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

I suspect shape declared there.

0
Dec 26 '13 at 20:17
source share



All Articles