Valid xml document must have a root tag как исправить

I have three image for Button, using png format.

I have made a Selector as below:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >

<!-- pressed -->
<item android:state_pressed="true" android:drawable="@drawable/press_pdgmap" />

<!-- hover -->
<item android:state_focused="true" android:drawable="@drawable/hover_pdgmap2" />

<!-- default -->
<item android:drawable="@drawable/hover_pdgmap" />

</selector>

But red tag appear in line pressed, hover, and default, it says

Top level element is not completed, Valid XML document must have a root tag

note: I’m using Android Studio

Remove the </android.support....> line and just close the tag so: />

Comments

  • Before asking this question, I searched goole and so as well but I could not found any help.
    The code looks well but I am unable to understand the error

    Valid XML document must have a root tag at line 15.

    Please have a look to the attached image.
    enter image description here

    any help will be much appreciated.

    Additional:

    I have analyzed code many times. But still getting the following:
    enter image description here
    Thanks in advance.
    Iqbal

  • May I ask the downvoter the reason for downvoting? If the answer has been accepted, I think it doesn’t deserve a -1.

Recents

Прежде чем задать этот вопрос, я искал гуляка и так же хорошо, но я не мог найти никакой помощи. Код выглядит хорошо, но я не могу понять ошибку

Valid XML document must have a root tag at line 15.

Пожалуйста, взгляните на прилагаемый образ.

Изображение 245105

Любая помощь будет высоко ценится.

Дополнительно:

Я много раз анализировал код. Но все еще получаю следующее: Изображение 245109
Заранее спасибо. Икбал

Прежде чем задать этот вопрос, я искал goole и так далее, но не нашел никакой помощи. Код выглядит хорошо, но я не могу понять ошибку

Valid XML document must have a root tag at line 15.

Посмотрите прикрепленное изображение. введите описание изображения здесь

Любая помощь будет высоко ценится.

Дополнительно:

Я много раз анализировал код. Но все равно получаю следующее: введите описание изображения здесь
Заранее спасибо. Икбал


2

Iqbal

15 Мар 2014 в 13:40

1 ответ

Лучший ответ

Удалите строку </android.support....> и просто закройте тег так: />


8

Phantômaxx
16 Мар 2014 в 13:35

Got 2 errors in Style.xml file

(1) Top level element isn’t completed
(2) valid xml documents must have a root tag

6 Answers

George Pirchalaishvili

Post your Style.xml code here please.

Amit Biswas March 25, 2015 12:47pm

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light.Dialog.NoActionBar">

<!— Customize your theme here. —>
</style>

</resources>

George Pirchalaishvili

Try adding this before code

<?xml version="1.0" encoding="utf-8"?>
<resources>

and this after

Amit Biswas March 25, 2015 12:54pm

ok

but I cant Run my App . when I press the Run menu ,bottom of the Edit configaration ..» Default Activity not found «

Amit Biswas March 25, 2015 12:57pm

Amit Biswas March 25, 2015 1:01pm

my errors are …in the «» Style.xml «» file .plz cheack over there

Понравилась статья? Поделить с друзьями:

Не пропустите также:

  • Противофаза как ее найти
  • Как найти картинки на виндовс 10
  • Как составить заявление на пособие по безработице
  • Как составить формирующий тест
  • Как исправить быстрое моргание поворотника

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии