2017-02-27 4 views
0

Ich verwende derzeit ein CoordinatorLayout in einer meiner XML-Dateien. Es ist das erste Mal, dass ich es tatsächlich benutze. Es gab keine Fehler vor der Codierung selbst, aber wenn ich versuche, das Design der XML zu sehen, sagt es immer CoordinatorLayout-Klasse nicht gefunden. Das gleiche gilt für mein TextInputLayout.CoordinatorLayout-Klasse nicht gefunden

Hier ist meine XML-Datei:

<?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" /> 

Und hier ist mein Build gradle:

apply plugin: 'com.android.application' 

    android { 
      compileSdkVersion 25 
      buildToolsVersion "25.0.2" 
      defaultConfig { 
       applicationId "com.exceptions.chatt" 
       minSdkVersion 19 
       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 { 
     compile fileTree(dir: 'libs', include: ['*.jar']) 
     androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
     compile "com.google.firebase:firebase-auth:9.0.2" 
     compile 'com.android.support:support-v4:25.2.0' 
     compile 'com.android.support:appcompat-v7:25.2.0' 
     testCompile 'junit:junit:4.12' 
    } 
    apply plugin: 'com.google.gms.google-services' 

Die API-Ebene, in dem ich das Design 25 Jahre alt war, um zu sehen versuchte. Ich habe kürzlich auch mein Android Studio aktualisiert. Was könnte das Problem sein?

Antwort

2

Sie können diese zu Ihrem dependancy hinzufügen:

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

Sync und laufen. Hoffe, das behebt das Problem

+0

Es hat funktioniert! Ich dachte, das Hinzufügen der neuesten Support-Version würde es beheben. Stellt sich heraus, ich muss Design selbst hinzufügen. Ich danke dir sehr! – Paradigm