Reputation: 361
I want to add Toolbar widget to my application. So when I add xml code to layout file I got Unbound prefix error. What should I do to solve this?
My layout.xml
<RelativeLayout 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: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="com.example.dizikolikk.MainActivity" >
<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
</RelativeLayout>
Upvotes: 1
Views: 595
Reputation: 17132
This error occurs when you use an undefined namespace in your XML layout (in this case it's the 'app' namespace)
You need to add
xmlns:app="http://schemas.android.com/apk/res-auto"
to your XML layout.
Upvotes: 5