为什么在我的项目中无法解析导入 android.support.v7.widget.Toolbar [英] Why the import android.support.v7.widget.Toolbar cannot be resolved in my project

查看:59
本文介绍了为什么在我的项目中无法解析导入 android.support.v7.widget.Toolbar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个需要工具栏的应用程序.我已经将appcompat_v7.jar"添加到我的项目中,但没有结果.

我已经查看了下面的一些链接,但他们无能为力.

正如您所看到的,v7 中的其他导入有效,但工具栏无效.我真的很需要你的帮助.

解决方案

查看您的 SDK Manager 屏幕截图,您使用的是旧版本的支持库.工具栏小部件直到 v21 才被引入,您使用的是 v20.升级到最新版本.

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.

解决方案

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.

这篇关于为什么在我的项目中无法解析导入 android.support.v7.widget.Toolbar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆