Why the import android.support.v7.widget.Toolbar c

2019-08-31 11:51发布

问题:

I've trying create an app which is need Toolbar. I've already add "appcompat_v7.jar" to my project which I've got no result.

I've already review some links below and they couldn't help so.

The Import android.support.v7 cannot be resolved

The import android.support.v7.app cannot be resolved

The Import android.support.v7 cannot be resolved

Here is my "AndroidManifect":

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.tabex"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="7"
        android:targetSdkVersion="21" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Also image from Eclipse:

As you can see other import from v7 works but the Toolbar not. I've really appropriate your help.

回答1:

Looking at your SDK Manager screenshot, you are using an old version of the Support Library. The Toolbar widget did not get introduced until v21, you are using v20. Upgrade to latest.



回答2:

I've Upgrade my Android Support Library to Latest version which is 23.0.1 and It's work hundred percent.