0

У меня есть панель инструментов и ViewPager в моем макете, но я получаю сообщение об ошибке в первой строке ViewPager. Что не так с моим viewPager?Как я могу решить эту проблему в своем макете: «ошибка: ошибка синтаксического анализа XML: несвязанный префикс»

Ошибка отображается "Ошибка: Анализ ошибок XML: несвязанный префикс".

Макет

<?xml version="1.0" encoding="utf-8"?> 
 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
 
    xmlns:app="http://schemas.android.com/apk/res/br.com.pixells.simuladorbr" 
 
    android:layout_width="fill_parent" 
 
    android:layout_height="fill_parent" 
 
    android:orientation="vertical" > 
 
    
 
    <android.support.v7.widget.Toolbar 
 
\t \t xmlns:android="http://schemas.android.com/apk/res/android" 
 
\t \t android:id="@+id/toolbarListaJogos" 
 
\t \t android:layout_width="match_parent" 
 
\t \t android:layout_height="wrap_content" 
 
\t \t android:background="#DC143C" 
 
\t \t app:subtitle="Teste" 
 
\t \t app:theme="@style/Theme.Abar.Widget" 
 
\t \t app:title="ToolBar" /> 
 
    
 
\t \t <android.support.v4.view.ViewPager 
 
\t \t  xmlns:android="http://schemas.android.com/apk/res/android" 
 
\t \t \t android:id="@+id/pager" 
 
\t \t \t android:layout_width="match_parent" 
 
\t \t \t android:layout_height="match_parent" 
 
\t \t \t tools:context=".MainActivity" > 
 
\t \t 
 
\t \t 
 
\t \t 
 
<!-- 
 
This title strip will display the currently visible page title, as well as the page 
 
titles for adjacent pages. 
 
--> 
 
\t \t 
 
\t \t \t <android.support.v4.view.PagerTitleStrip 
 
\t \t \t \t android:id="@+id/pager_title_strip" 
 
\t \t \t \t android:layout_width="match_parent" 
 
\t \t \t \t android:layout_height="wrap_content" 
 
\t \t \t \t android:layout_gravity="top" 
 
\t \t \t \t android:background="#33b5e5" 
 
\t \t \t \t android:paddingBottom="4dp" 
 
\t \t \t \t android:paddingTop="4dp" 
 
\t \t \t \t android:textColor="#fff" /> 
 
\t \t 
 
\t \t 
 
\t \t </android.support.v4.view.ViewPager> 
 

 
</LinearLayout>

ответ

1

Вы использовали "инструменты" префикс для атрибута в вашем ViewPager без объявления пространства имен XML в корне.

Добавить

xmlns:tools="http://schemas.android.com/tools" 

к вашему LinearLayout, чтобы исправить эту проблему.

Смежные вопросы