2016-09-09 7 views
0

Android開発を学ぼうとしています。 Android Studio 2.1.3を使用していて、ログイン機能を作成しようとしました。プロジェクトの作成中にログインアクティビティテンプレートを使用し、ウィザードの他のすべてをデフォルトにしました。私はそれが何を作成したかをプレビューしようとすると、このエラーを示します。次のクラスをインスタンス化できませんでした:android.support.design.widget.TextInputLayout

次のクラスをインスタンス化できませんでした:android.support.design.widget.TextInputLayoutデフォルトで

ターゲットとするには、Androidのバージョンは、私は15にそれを変更し、それでも同じエラー24として示しました。これを解決するには?

enter image description here

レイアウト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で回答を試し、そのうちの1つが君は。 –

+0

@ChadSchultz私は今レイアウトxmlで質問を更新しました。また、私はキャッシュを無効にしようとしました/再起動しても問題は解決しませんでした。また、私はアンドロイドバージョンを24から15に変更しようとしましたが、それも問題を解決しませんでした – prasanth

答えて

0

あなたは(あなたのGradleへcompile 'com.android.support:appcompat-v7:xxx を追加することにより、APPCOMPAT使用するか、21または上にあなたのGradleであなたのminsdkを変更するか、ロリポップはに最初のものですサポートマテリアルデザイン)。

Read Documention here

の下位互換性を維持することについての詳細を学ぶため。

関連する問題