找不到android.support.v7.widget.Toolbar(Android Studio)

时间:2015-07-21 18:53:33

标签: android xml android-layout android-studio android-support-library

从现在开始约2周后,每当我尝试在Android Studio项目中预览.xml设计文件时,都会收到错误消息。由于我对整个主题比较新,我想问你是否有答案。

错误消息:
 渲染问题:
 找不到以下课程:
- android.support.v7.widget.Toolbar

渲染问题:
 找不到以下课程:
- android.support.v7.widget.CardView

其中一个.xml文件:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/toolbar_tabs"
    android:background="@color/primaryColor"
    app:contentInsetStart="0dp"
    app:contentInsetEnd="0dp">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="56dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="VPlan App RC1"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="@color/white"
                android:textSize="20sp"
                android:layout_marginLeft="16dp"
                android:fontFamily="sans-serif-medium"
                android:id="@+id/textView7"
                android:layout_marginStart="16dp"
                android:layout_centerVertical="true"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true" />


            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_marginRight="16dp"
                android:layout_marginTop="16dp"
                android:layout_centerHorizontal="true"
                android:src="@drawable/ic_refresh"
                android:id="@+id/ic_refresh"/>

        </RelativeLayout>
        <com.astuetz.PagerSlidingTabStrip
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:background="@color/primaryColor"
            android:textColorPrimary="@color/white"
            android:textSize="14sp"
            android:id="@+id/tabs"
            android:layout_marginTop="?attr/actionBarSize" />
    </RelativeLayout>


</android.support.v7.widget.Toolbar>

另外,它可能会有所帮助,这是支持库所在的build.gradle文件。

build.grade文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion '22.0.1'
    defaultConfig {
        applicationId 'com.nocomment.vplanehs'
        minSdkVersion 10
        targetSdkVersion 22
        versionCode 16
        versionName '0.8.5_RC1'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(':volley')
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:cardview-v7:22.1.1'
    compile 'com.android.support:recyclerview-v7:22.1.1'
    compile 'com.android.support:support-v4:22.2.1'
    compile 'com.jpardogo.materialtabstrip:library:1.0.9'
}

在这个项目中,我们也使用齐声以及ZXing QR码阅读器中的库 如果有人能帮助我,我会非常感激。提前谢谢!

0 个答案:

没有答案