I am using three libraries in my project:
a. ViewPager
b. SherlockActionBar
c. PagerSlidingTabStrip
In my layout xml, I am getting the following error parsing XML
in here:
<com.astuetz.viewpager.extensions.PagerSlidingTabStrip
android:id="@+id/strips"
android:layout_width="match_parent"
android:layout_height="48dip"
app:indicatorColor="#FF9326"
app:textAllCaps="false" />
I implemented the library same as the two other libraries used in the project. The other two libraries are running smoothly. Error only exists within this. Please help.
Full layout 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>
I have already tried cleaning the project, re-adding library to the workspace, etc.
Try to add custom properties reference using res-auto
xmlns schemas
<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>
Add
xmlns:app="http://schemas.android.com/apk/res-auto"
to the root layout of the xml.
I didn't have a LinearLayout
as my root XML element.
I had an android.support.v4.view.ViewPager
instead because I was using the AppCompat Library.
So, this was what I did:
** I included the tools:context=".classname"
line and that's where the Error parsing XML: unbound prefix
comes from (in part). It's brought about when you referrence a path that Eclipse/Studio can't see when it's building your xml layout.
Solution:
I added the xmlns:tools="http://schemas.android.com/tools"
to point ADT to my tools
location, and we were good to go!
FINAL CODE:
<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"
/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With