0
    import android.os.Bundle;
    import android.support.v4.view.ViewPager;
    import android.support.v7.app.ActionBar;
    import android.support.v7.app.ActionBarActivity;
    import android.widget.Toolbar;
    import com.tablayout.SlidingTabLayout;
    import com.tablayout.ViewPagerAdapter;

    public class HomeActivity extends ActionBarActivity {

        Toolbar toolbar;
        ViewPager pager;
        ViewPagerAdapter adapter;
        SlidingTabLayout tabs;
        CharSequence Titles[] = { "Gallery", "Buy", "Project" };
        int Numboftabs = 3;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_home);

            ActionBar actionBar = getSupportActionBar();

            actionBar.setDisplayShowHomeEnabled(false);
            actionBar.setDisplayShowTitleEnabled(false);
            actionBar.hide();

            adapter = new ViewPagerAdapter(getSupportFragmentManager(), Titles,
                    Numboftabs);

            pager = (ViewPager) findViewById(R.id.pager);
            pager.setAdapter(adapter);

            tabs = (SlidingTabLayout) findViewById(R.id.tabs);
            tabs.setDistributeEvenly(true);

            tabs.setCustomTabColorizer(new SlidingTabLayout.TabColorizer() {
                @Override
                public int getIndicatorColor(int position) {

                    return getResources().getColor(R.color.tabsScrollColor);

                }
            });

            tabs.setViewPager(pager);

        }

    }` 



    and this is my xml file 


    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:background="#331c57"
            android:orientation="vertical" >

            <LinearLayout
                android:id="@+id/linearLayout1"
                android:layout_width="wrap_content"
                android:layout_height="60dp"
                android:layout_centerVertical="true"
                android:gravity="center"
                android:orientation="vertical" >

                <ImageView
                    android:id="@+id/imageView1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:src="@drawable/gappshapp" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/linearLayout3"
                android:layout_width="40dp"
                android:layout_height="60dp"
                android:layout_alignParentRight="true"
                android:gravity="center"
                android:orientation="vertical" >

                <ImageView
                    android:id="@+id/imageView3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:src="@drawable/threedots" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/linearLayout4"
                android:layout_width="40dp"
                android:layout_height="60dp"
                android:layout_toLeftOf="@+id/linearLayout3"
                android:gravity="center"
                android:orientation="vertical" >

                <ImageView
                    android:id="@+id/imageView4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_centerVertical="true"
                    android:src="@drawable/callsplus" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/linearLayout5"
                android:layout_width="40dp"
                android:layout_height="60dp"
                android:layout_toLeftOf="@+id/linearLayout4"
                android:gravity="center"
                android:orientation="vertical" >

                <ImageView
                    android:id="@+id/imageView5"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_centerVertical="true"
                    android:src="@drawable/searchicon" />
            </LinearLayout>
        </RelativeLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <com.tablayout.SlidingTabLayout
                android:id="@+id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#cecece"
                android:elevation="2dp" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

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

    </LinearLayout>`


    Error inflating class android.support.v7.widget.Toolbar

       My app crashes in the Home activity 


   I jst updated the sdk manager
the Android Support Library and import the  android-support-v7-appcompact again and use it in my project but it still have the issue

 how to solve this issue? 

I m tired of this problem, please help me out....


my configure build file is

enter image description here

and my sdk manager is here

enter image description here

    `

i change my target in project property file also to 23 and also in library android support v7 appcompact project property now what kind of change i have do to remove this issue..

plase help me out from this issue

Azad chouhan
  • 167
  • 2
  • 19

1 Answers1

0

To use the Support Library your App theme needs to extend a Theme.AppCompat style.

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

And in the Manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.app">

    <application
        ...
        android:theme="@style/AppTheme">
            ...
    </application>
</manifest>

And you are also recreating the Toolbar yourself with LinearLayouts. The purpose of the new Toolbar is to be able to be included in the layout and still offer the back/menu button and options menu functionality.

You should include the Toolbar in your layout like its explained here

<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"/>
Saenic
  • 1,593
  • 13
  • 14