Подтвердить что ты не робот

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

Я использую три библиотеки в моем проекте:

a. ViewPager
b. SherlockActionBar
c. PagerSlidingTabStrip

В моем макете xml я получаю следующее error parsing XML здесь:

<com.astuetz.viewpager.extensions.PagerSlidingTabStrip
    android:id="@+id/strips"
    android:layout_width="match_parent"
    android:layout_height="48dip"
    app:indicatorColor="#FF9326"
    app:textAllCaps="false" />

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

Полный макет xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainSlider" >

    <com.astuetz.viewpager.extensions.PagerSlidingTabStrip
        android:id="@+id/strips"
        android:layout_width="match_parent"
        android:layout_height="48dip"
        app:indicatorColor="#FF9326"
        app:textAllCaps="false" />

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />

</LinearLayout>

Я уже пробовал очистить проект, повторно добавить библиотеку в рабочую область и т.д.

4b9b3361

Ответ 1

Попробуйте добавить ссылку на настраиваемые свойства с помощью res-auto схем xmlns

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainSlider" >

    <com.astuetz.viewpager.extensions.PagerSlidingTabStrip
        android:id="@+id/strips"
        android:layout_width="match_parent"
        android:layout_height="48dip"
        app:indicatorColor="#FF9326"
        app:textAllCaps="false" />

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />

</LinearLayout>

Ответ 2

Добавить

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

к корневому расположению xml.

Ответ 3

У меня не было LinearLayout в качестве моего корневого XML-элемента.
У меня был android.support.v4.view.ViewPager вместо этого, потому что я использовал AppCompat Library.

Итак, это было то, что я сделал:
** Я включил строку tools:context=".classname" и что где Error parsing XML: unbound prefix происходит (частично). Это произошло, когда вы ссылаетесь на путь, который Eclipse/Studio не видит при построении xml макета.

Решение:
Я добавил xmlns:tools="http://schemas.android.com/tools", чтобы указать ADT в мое расположение tools, и нам было хорошо идти!

ЗАКЛЮЧИТЕЛЬНЫЙ КОД:

<android.support.v4.view.ViewPager 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/pager"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".home"
    />

Ответ 4

Корневой элемент каждого xml должен содержать:

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

И вы можете использовать атрибуты android после.

Ответ 5

В моем проекте Android эта ошибка отображается в файле XML. Ошибка синтаксического анализа XML: несвязанный префикс.

там мой код.. пожалуйста, решите мою проблему

xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
tools:context="com.example.arifa.model.MainActivity">

<com.github.clans.fab.FloatingActionMenu
    android:id="@+id/social_floating_menu"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_marginBottom="11dp"
    android:layout_marginLeft="11dp"
    android:layout_marginRight="11dp"
    fab:menu_animationDelayPerItem="55"
    fab:menu_backgroundColor="@android:color/transparent"
    fab:menu_buttonSpacing="0dp"
    fab:menu_colorNormal="#da3c2f"
    fab:menu_colorPressed="#dc4b3f"
    fab:menu_colorRipple="#99d4d4d4"
    fab:menu_fab_label="Floating Social Icons"
    fab:menu_fab_size="normal"
    fab:menu_icon="@drawable/fab_add"
    fab:menu_labels_colorNormal="#333"
    fab:menu_labels_colorPressed="#444"
    fab:menu_labels_colorRipple="#66efecec"
    fab:menu_labels_cornerRadius="3dp"
    fab:menu_labels_ellipsize="none"
    fab:menu_labels_hideAnimation="@anim/fab_slide_out_to_right"
    fab:menu_labels_margin="0dp"
    fab:menu_labels_maxLines="-1"
    fab:menu_labels_padding="8dp"
    fab:menu_labels_position="left"
    fab:menu_labels_showAnimation="@anim/fab_slide_in_from_right"
    fab:menu_labels_showShadow="true"
    fab:menu_labels_singleLine="false"
    fab:menu_labels_textColor="#f2f1f1"
    fab:menu_labels_textSize="15sp"
    fab:menu_openDirection="up"
    fab:menu_shadowColor="#66aff198"
    fab:menu_shadowRadius="4dp"
    fab:menu_shadowXOffset="1dp"
    fab:menu_shadowYOffset="4dp"
    fab:menu_showShadow="true">

    <com.github.clans.fab.FloatingActionButton
        android:id="@+id/floating_facebook"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/imageone"
        fab:fab_size="mini" />

    <com.github.clans.fab.FloatingActionButton
        android:id="@+id/floating_twitter"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/notification"
        fab:fab_size="mini" />

    <com.github.clans.fab.FloatingActionButton
        android:id="@+id/floating_linkdin"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/one"
        fab:fab_size="mini" />

    <com.github.clans.fab.FloatingActionButton
        android:id="@+id/floating_google_plus"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/imageone"
        fab:fab_size="mini" />

    <com.github.clans.fab.FloatingActionButton
        android:id="@+id/floating_instagram"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/imageone"
        fab:fab_size="mini" />

    <com.github.clans.fab.FloatingActionButton
        android:id="@+id/floating_youtube"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/notification"
        fab:fab_size="mini" />

</com.github.clans.fab.FloatingActionMenu>

Ответ 6

уже есть корневой элемент

xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
tools:context="com.example.arifa.model.MainActivity"
android:weightSum="1">

Ответ 7

Удалите и добавьте это снова:

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

Затем очистите и постройте проект.