0

this is the xml file of tab layout in which define toolbar,viepage so how fix this error.i dont know how to fix it please help me or suggest me where am doing wrong Probably is something very simple, but I am stucked. Any idea?please heplp

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="?attr/colorPrimary"
            android:fitsSystemWindows="true"
            android:minHeight="?attr/actionBarSize"
            android:padding="2dp"
            app:titleMarginStart="20dp"
            app:titleTextAppearance="@style/AppTheme.Toolbar.Title" />

        <com.tutorialsbuzz.slidingtabdemo.SlidingTabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/holo_orange_dark" />

        <android.support.v4.view.ViewPager
            android:id="@+id/pager"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#e5e5e5" >
        </android.support.v4.view.ViewPager>

    </LinearLayout>
Sumit Kumawat
  • 127
  • 10

3 Answers3

0

You need add xmlns attribute to your root element. Something like:

<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/com.tutorialsbuzz.slidingtabdemo"
Vasily Kabunov
  • 6,511
  • 13
  • 49
  • 53
0

Try this code. and check if you have tabstrip.java file in your pakage. which is required for it to work properly

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_height="match_parent" android:layout_width="match_parent">

            <android.support.v7.widget.Toolbar
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/toolbar"
                android:background="@color/primary"
                android:minHeight="?attr/actionBarSize">
            </android.support.v7.widget.Toolbar>


            <com.example.SlidingTabLayout
                android:layout_below="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/sliding_tab">  
            </com.example.SlidingTabLayout>


            <android.support.v4.view.ViewPager
                android:id="@+id/pager"
                android:layout_below="@+id/sliding_tab"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

            </android.support.v4.view.ViewPager>
        </RelativeLayout>
prabhat yadav
  • 93
  • 2
  • 11
0

You might need to follow this,

You need to add some content to parent node or issue with namespace

First node needs to add : xmlns:android="http://schemas.android.com/apk/res/android"

Check this stack answer.

Hope this helps.

Community
  • 1
  • 1
Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142