小编Jor*_*erg的帖子

在包中找不到属性"layout_constraintLeft_toLeftOf"的资源标识符

我使用的是Android SDK 2.2.3.我正在关注一本关于Android编程的书.

代码是:

<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="eu.a123sandberg.webview.MainActivity"
    tools:layout_editor_absoluteX="0dp"
    tools:layout_editor_absoluteY="81dp">

    <WebView
        android:layout_width="384dp"
        android:layout_height="511dp"
        tools:layout_editor_absoluteX="0dp"
        tools:layout_editor_absoluteY="0dp"
        app:layout_constraintLeft_toLeftOf="@+id/activity_main"
        tools:layout_constraintLeft_creator="0"
        app:layout_constraintTop_toTopOf="@+id/activity_main"
        tools:layout_constraintTop_creator="0"
        app:layout_constraintRight_toRightOf="@+id/activity_main"
        tools:layout_constraintRight_creator="0"
        app:layout_constraintBottom_toBottomOf="@+id/activity_main"
        tools:layout_constraintBottom_creator="0"
        />

</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)

我用android.support.constraint.ConstraintLayout尝试了三个不同的例子,在所有情况下我都会收到相同的错误消息:

Error:(13) No resource identifier found for attribute 'layout_constraintLeft_toLeftOf' in package 'eu.a123sandberg.webview'
Run Code Online (Sandbox Code Playgroud)

build.gradle文件包含:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "eu.a123sandberg.webview"
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
                                                                                  testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-                   android.txt'), 'proguard-rules.pro'
        }
     }
}

dependencies …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-studio android-constraintlayout

36
推荐指数
1
解决办法
3万
查看次数