2017-03-17 2 views
3

このエラー(タイトル)を取得しています。 多くの投稿は、(私はそれをやった)App.Appcompatにテーマを変更するために私にもAndroidスタジオを提案しました。Android "デザインライブラリでTheme.AppCompatテーマ(または子孫)を使用する必要があります。"

マニフェストファイル:

<uses-permission android:name="android.permission.INTERNET" /> 

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/Theme.AppCompat"> 
    <activity 
     android:name=".activity.MainActivity" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme.NoActionBar"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 

    <activity 
     android:name=".activity.ContactAcitivty" 
     android:label="@string/activity_title_contact" /> 
    <activity 
     android:name=".activity.CopyrightActivity" 
     android:label="@string/activity_title_copyright" /> 
    <activity android:name=".activity.FormActivity"> 
      <intent-filter> 
       <action android:name="info.androidhive.navigationdrawer.activity.FormActivity" /> 

       <category android:name="android.intent.category.DEFAULT" /> 
      </intent-filter> 
     </activity> 

</application> 

Style.xml

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <!-- Customize your theme here. --> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
    </style> 
    <style name="AppTheme.NoActionBar"> 
    <item name="windowActionBar">false</item> 
    <item name="windowNoTitle">true</item> 
</style> 
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> 
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> 

しかし、それでもまだ、何も変わっていません。

私は前にこの問題を抱えていなかったので、私は

のGradle(私はマニフェストファイルbforeにApp.compatを追加しませんでした)何が起こったのかわからない:

compile 'com.android.support:appcompat-v7:24.0.0-beta1' 
compile 'com.android.support:design:24.0.0-beta1' 
compile 'com.android.support:support-v4:24.0.0-beta1' 
compile 'com.github.bumptech.glide:glide:3.7.0' 
compile 'com.android.support.constraint:constraint-layout:+' 
testCompile 'junit:junit:4.12' 

エラーログ:あなたの助けのための

java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme  (or descendant) with the design library.    
at android.support.design.widget.ThemeUtils.checkAppCompatTheme(ThemeUtils.java:36)     
at android.support.design.widget.NavigationView.<init> (NavigationView.java:102)    
at android.support.design.widget.NavigationView.<init>(NavigationView.java:96)    
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)   
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)     at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858)      

at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)   
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)    
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)   
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 

おかげ

+1

がフルマニフェストを投稿... – rafsanahmad007

+1

は、なぜあなたは、サポートライブラリのベータ版を使用していますか? – rafsanahmad007

+0

私は自分の投稿を編集しました。私はナビゲーションチュートリアルのチュートリアルの後、この1つをhttp://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/にしていますので、チュートリアルで説明したベータ版を使用しました –

答えて

8

Theme.AppCompat

変更

<style name="AppTheme.NoActionBar">

の子孫ではありません。

Gradleの中

compile 'com.android.support:appcompat-v7:25.2.0' 
compile 'com.android.support:support-v4:25.2.0' 
compile 'com.android.support:design:25.2.0' 

また、マニフェストにあなたのNavaigation引き出し `活動にappcompatテーマを追加

<activity android:name=".activity.FormActivity" 
      android:theme="@style/Theme.AppCompat"> 
      <intent-filter> 
       <action android:name="info.androidhive.navigationdrawer.activity.FormActivity" /> 

       <category android:name="android.intent.category.DEFAULT" /> 
      </intent-filter> 
     </activity> 
3

あなたMainActivity@style/AppTheme.NoActionBarテーマを使用している、そしてそれは、この変更を試みる

<style name="AppTheme.NoActionBar" parent="AppTheme">

関連する問題