2016-09-09 3 views
0

Попытка изучить разработку Android. Я использую Android Studio 2.1.3 и пытаюсь создать функцию входа в систему. Создал шаблон входа в систему при создании проекта и оставил все остальное в мастере по умолчанию. Когда я попытался просмотреть, что именно он создал, он показывает эту ошибку.Следующие классы не могут быть созданы: android.support.design.widget.TextInputLayout

Следующие классы не могут быть созданы: android.support.design.widget.TextInputLayout

По умолчанию андроид версию предназначаться отображался как 24 я изменил его до 15, но все та же ошибка. Как это решить?

enter image description here

Layout XML

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:gravity="center_horizontal" 
    android:orientation="vertical" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context="com.example.user.loginapp.Login"> 

    <!-- Login progress --> 
    <ProgressBar 
     android:id="@+id/login_progress" 
     style="?android:attr/progressBarStyleLarge" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="8dp" 
     android:visibility="gone" /> 

    <ScrollView 
     android:id="@+id/login_form" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <LinearLayout 
      android:id="@+id/email_login_form" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical"> 

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

       <AutoCompleteTextView 
        android:id="@+id/email" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/prompt_email" 
        android:inputType="textEmailAddress" 
        android:maxLines="1" 
        android:singleLine="true" /> 

      </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="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/prompt_password" 
        android:imeActionId="@+id/login" 
        android:imeActionLabel="@string/action_sign_in_short" 
        android:imeOptions="actionUnspecified" 
        android:inputType="textPassword" 
        android:maxLines="1" 
        android:singleLine="true" /> 

      </android.support.design.widget.TextInputLayout> 

      <Button 
       android:id="@+id/email_sign_in_button" 
       style="?android:textAppearanceSmall" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="16dp" 
       android:text="@string/action_sign_in" 
       android:textStyle="bold" /> 

     </LinearLayout> 
    </ScrollView> 
</LinearLayout> 
+0

Можете ли вы предоставить XML для файла макета, который вы используете? –

+0

Также попробуйте ответы на http://stackoverflow.com/questions/26575815/the-following-classes-could-not-be-instantiated-android-support-v7-widget-too и посмотрите, работает ли один из них для вы. –

+0

@ChadSchultz Я обновил вопрос с помощью макета xml сейчас. Кроме того, я попытался сделать Invalidate Caches/Restart, это не решило проблему. Также я попытался изменить версию Android с 24 до 15, это тоже не решило проблему. – prasanth

ответ

0

Вы можете использовать AppCompat путем добавления compile 'com.android.support:appcompat-v7:xxx к вашему Gradle или изменить minsdk в вашем Gradle до 21 или выше (Lolipop является первым в поддержка дизайна материалов).

Read Documention here

, чтобы узнать больше о сохранении обратной совместимости.

Смежные вопросы