Invalid start tag for Android

I am trying to set the tabhost selector since I found an example demonstrating that I have to create an xml file in drawable as follows:

<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/hotel_selected" android:state_selected="true" /> <item android:drawable="@drawable/hotel" /> </selector> 

but when compiling, eclipse keeps saying that this is an invalid start tag in this file.

please help me solve this problem.

many thanks.

+6
source share
5 answers

The solution, I created an xml file using a simple text editor (notepad ++) and saved it in /res/drawable and compiled, the result: it worked like a charm :)

+12
source

The ideal solution would be to put the XML file in

 /res/xml 
+6
source

You can right-click on the directory that you want to create the XML file, select the xml file, and then edit this file. This solved my problem.

+1
source

I ran into the same error and then decided that I made a mistake adding the xml file to the values ​​folder so that it could not recognize the selector tag. I deleted it from the values ​​folder and added it to the transferable folder, and it worked without any errors. this was the case with Xamarin.Android.

0
source

It seems that there are no errors.

There may be some kind of problem. But you can do one thing: Project β†’ Clean , it can solve your problem.

-1
source

Source: https://habr.com/ru/post/885563/


All Articles