Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 找不到CoordinatorLayout类_Android - Fatal编程技术网

Android 找不到CoordinatorLayout类

Android 找不到CoordinatorLayout类,android,Android,我目前正在我的一个xml文件中使用CoordinatorLayout。这是我第一次实际使用它。在编码之前没有错误,但是当我尝试查看xml的设计时,它总是说找不到CoordinatorLayout类。我的TextInputLayout也是如此 这是我的xml文件: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:

我目前正在我的一个xml文件中使用CoordinatorLayout。这是我第一次实际使用它。在编码之前没有错误,但是当我尝试查看xml的设计时,它总是说找不到CoordinatorLayout类。我的TextInputLayout也是如此

这是我的xml文件:

    <?xml version="1.0" encoding="utf-8"?>
    <android.support.design.widget.CoordinatorLayout       
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:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.exceptions.chatt.LoginActivity">

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/colorPrimary"
    android:gravity="center"
    android:orientation="vertical"
    android:padding="@dimen/activity_horizontal_margin">


    <ImageView
        android:layout_width="@dimen/logo_w_h"
        android:layout_height="@dimen/logo_w_h"
        android:layout_gravity="center_horizontal"
        android:layout_marginBottom="30dp"
        android:src="@mipmap/ic_launcher" />

    <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <EditText
            android:id="@+id/email"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:hint="@string/hint_email"
            android:inputType="textEmailAddress"
            android:textColor="@android:color/white"
            android:textColorHint="@android:color/white" />
    </android.support.design.widget.TextInputLayout>

    <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <EditText
            android:id="@+id/password"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:hint="@string/hint_password"
            android:inputType="textPassword"
            android:textColor="@android:color/white"
            android:textColorHint="@android:color/white" />
    </android.support.design.widget.TextInputLayout>

    <!-- Login Button -->

    <Button
        android:id="@+id/btn_login"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dip"
        android:background="@color/colorAccent"
        android:text="@string/btn_login"
        android:textColor="@android:color/black" />

    <Button
        android:id="@+id/btn_reset_password"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dip"
        android:background="@null"
        android:text="@string/btn_forgot_password"
        android:textAllCaps="false"
        android:textColor="@color/colorAccent" />

    <!-- Link to Login Screen -->

    <Button
        android:id="@+id/btn_signup"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dip"
        android:background="@null"
        android:text="@string/btn_link_to_register"
        android:textAllCaps="false"
        android:textColor="@color/white"
        android:textSize="15dp" />
</LinearLayout>

<ProgressBar
    android:id="@+id/progressBar"
    android:layout_width="30dp"
    android:layout_height="30dp"
    android:layout_gravity="center|bottom"
    android:layout_marginBottom="20dp"
    android:visibility="gone" />

我试图查看设计的API级别是25。我最近还更新了我的Android Studio。可能有什么问题?

您可以将此添加到您的依赖性中:

dependancy{
....
 compile 'com.android.support:design:25.2.0'
}

同步并运行。希望这能解决问题

您可以将此添加到您的依赖性中:

dependancy{
....
 compile 'com.android.support:design:25.2.0'
}

同步并运行。希望这能解决问题

它奏效了!我认为添加最新的支持版本可以解决这个问题。事实证明,我需要添加设计本身。非常感谢你!成功了!我认为添加最新的支持版本可以解决这个问题。事实证明,我需要添加设计本身。非常感谢你!