2016-07-22 1 views
2

Custom Action BarAndroid Holo Colors Generator을 사용하여 내 안드로이드 앱에 테마 디자인을 구현 중입니다. 액션 바 스타일이 잘 작동합니다. 그러나 Android Holo Colors Generator을 사용하여 사용자 지정 테마를 구현할 때 문제가 발생합니다. 오류는 여기android의 커스텀 테마 디자인 문제

com.myapp.testing.theme E/AndroidRuntime: FATAL EXCEPTION: main 
    Process: com.myapp.testing.theme, PID: 25491 
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp.testing.theme/assetviewer.findergpstracking.com.finder.activity.HomeActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.design.widget.CoordinatorLayout 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3124) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3233) 
    at android.app.ActivityThread.access$1000(ActivityThread.java:197) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:145) 
    at android.app.ActivityThread.main(ActivityThread.java:6856) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:372) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) 
    Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.design.widget.CoordinatorLayout 
    at android.view.LayoutInflater.createView(LayoutInflater.java:640) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750) 
    at android.view.LayoutInflater.parseInclude(LayoutInflater.java:904) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:511) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:415) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:366) 
    at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) 
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
    at assetviewer.findergpstracking.com.finder.activity.HomeActivity.onCreate(HomeActivity.java:152) 
    at android.app.Activity.performCreate(Activity.java:6550) 
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120) 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3077) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3233)  
    at android.app.ActivityThread.access$1000(ActivityThread.java:197)  
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)  
    at android.os.Handler.dispatchMessage(Handler.java:102)  
    at android.os.Looper.loop(Looper.java:145)  
    at android.app.ActivityThread.main(ActivityThread.java:6856)  
    at java.lang.reflect.Method.invoke(Native Method)  
    at java.lang.reflect.Method.invoke(Method.java:372)  
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)  
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)  
    Caused by: java.lang.reflect.InvocationTargetException 
    at java.lang.reflect.Constructor.newInstance(Native Method) 
    at java.lang.reflect.Constructor.newInstance(Constructor.java:288) 
    at android.view.LayoutInflater.createView(LayoutInflater.java:614) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)  
    at android.view.LayoutInflater.parseInclude(LayoutInflater.java:904)  
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)  
    at android.view.LayoutInflater.inflate(LayoutInflater.java:511)  
    at android.view.LayoutInflater.inflate(LayoutInflater.java:415)  
    at android.view.LayoutInflater.inflate(LayoutInflater.java:366)  
    at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)  
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)  
    at assetviewer.findergpstracking.com.finder.activity.HomeActivity.onCreate(HomeActivity.java:152)  
    at android.app.Activity.performCreate(Activity.java:6550)  
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120)  
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3077)  
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3233)  
    at android.app.ActivityThread.access$1000(ActivityThread.java:197)  
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)  
    at android.os.Handler.dispatchMessage(Handler.java:102)  
    at android.os.Looper.loop(Looper.java:145)  
    at android.app.ActivityThread.main(ActivityThread.java:6856)  
    at java.lang.reflect.Method.invoke(Native Method)  
    at java.lang.reflect.Method.invoke(Method.java:372)  
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)  
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)  
    Caused by: 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:34) 
    at android.support.design.widget.CoordinatorLayout.<init>(CoordinatorLayout.java:184) 
    at android.support.design.widget.CoordinatorLayout.<init>(CoordinatorLayout.java:178) 
    at java.lang.reflect.Constructor.newInstance(Native Method)  
    at java.lang.reflect.Constructor.newInstance(Constructor.java:288)  
    at android.view.LayoutInflater.createView(LayoutInflater.java:614)  
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)  
    at android.view.LayoutInflater.parseInclude(LayoutInflater.java:904)  
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)  
    at android.view.LayoutInflater.inflate(LayoutInflater.java:511)  
    at android.view.LayoutInflater.inflate(LayoutInflater.java:415)  
    at android.view.LayoutInflater.inflate(LayoutInflater.java:366)  
    at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)  
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)  
    at assetviewer.findergpstracking.com.finder.activity.HomeActivity.onCreate(HomeActivity.java:152)  
    at android.app.Activity.performCreate(Activity.java:6550)  
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120)  
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3077)  
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3233)  
    at android.app.ActivityThread.access$1000(ActivityThread.java:197)  
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)  
    at android.os.Handler.dispatchMessage(Handler.java:102)  
    at android.os.Looper.loop(Looper.java:145)  
    at android.app.ActivityThread.main(ActivityThread.java:6856)  
    at java.lang.reflect.Method.invoke(Native Method)  
    at java.lang.reflect.Method.invoke(Method.java:372)  
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)  
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)  

내 스타일 테마

<resources> 

<style name="Theme.Findertheme" parent="@style/AppTheme"> 
    <item name="actionBarItemBackground">@drawable/selectable_background_findertheme</item> 
    <item name="popupMenuStyle">@style/PopupMenu.Findertheme</item> 
    <item name="dropDownListViewStyle">@style/DropDownListView.Findertheme</item> 
    <item name="actionBarTabStyle">@style/ActionBarTabStyle.Findertheme</item> 
    <item name="actionDropDownStyle">@style/DropDownNav.Findertheme</item> 
    <item name="actionBarStyle">@style/ActionBar.Transparent.Findertheme</item> 
    <item name="actionModeBackground">@drawable/cab_background_top_findertheme</item> 
    <item name="actionModeSplitBackground">@drawable/cab_background_bottom_findertheme</item> 
    <item name="actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Findertheme</item> 

    <item name="windowNoTitle">true</item> 
    <item name="windowActionBar">false</item> 
</style> 

<style name="ActionBar.Solid.Findertheme" parent="@style/Widget.AppCompat.ActionBar.Solid"> 
    <item name="background">@drawable/ab_solid_findertheme</item> 
    <item name="backgroundStacked">@drawable/ab_stacked_solid_findertheme</item> 
    <item name="backgroundSplit">@drawable/ab_bottom_solid_findertheme</item> 
    <item name="progressBarStyle">@style/ProgressBar.Findertheme</item> 
</style> 

<style name="ActionBar.Transparent.Findertheme" parent="@style/Widget.AppCompat.ActionBar"> 
    <item name="background">@drawable/ab_transparent_findertheme</item> 
    <item name="progressBarStyle">@style/ProgressBar.Findertheme</item> 
</style> 

<style name="PopupMenu.Findertheme" parent="@style/Widget.AppCompat.PopupMenu"> 
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_findertheme</item> 
</style> 

<style name="DropDownListView.Findertheme" parent="@style/Widget.AppCompat.ListView.DropDown"> 
    <item name="android:listSelector">@drawable/selectable_background_findertheme</item> 
</style> 

<style name="ActionBarTabStyle.Findertheme" parent="@style/Widget.AppCompat.ActionBar.TabView"> 
    <item name="android:background">@drawable/tab_indicator_ab_findertheme</item> 
</style> 

<style name="DropDownNav.Findertheme" parent="@style/Widget.AppCompat.Spinner.DropDown.ActionBar"> 
    <item name="android:background">@drawable/spinner_background_ab_findertheme</item> 
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_findertheme</item> 
    <item name="android:dropDownSelector">@drawable/selectable_background_findertheme</item> 
</style> 

<style name="ProgressBar.Findertheme" parent="@style/Widget.AppCompat.ProgressBar.Horizontal"> 
    <item name="android:progressDrawable">@drawable/progress_horizontal_findertheme</item> 
</style> 

<style name="ActionButton.CloseMode.Findertheme" parent="@style/Widget.AppCompat.ActionButton.CloseMode"> 
    <item name="android:background">@drawable/btn_cab_done_findertheme</item> 
</style> 

<!-- this style is only referenced in a Light.DarkActionBar based theme --> 
<style name="Theme.Findertheme.Widget" parent="@style/Theme.AppCompat"> 
    <item name="popupMenuStyle">@style/PopupMenu.Findertheme</item> 
    <item name="dropDownListViewStyle">@style/DropDownListView.Findertheme</item> 
</style> 

<resources xmlns:android="http://schemas.android.com/apk/res/android"> 

    <style name="AppTheme" parent="android:Theme.Holo"> 
     <item name="android:editTextBackground">@drawable/apptheme_edit_text_holo_dark</item> 
     <item name="android:listChoiceIndicatorMultiple">@drawable/apptheme_btn_check_holo_dark</item> 
     <item name="android:buttonStyle">@style/ButtonAppTheme</item> 
     <item name="android:imageButtonStyle">@style/ImageButtonAppTheme</item> 
     <item name="android:dropDownSpinnerStyle">@style/SpinnerAppTheme</item> 
     <item name="android:progressBarStyleHorizontal">@style/ProgressBarAppTheme</item> 
     <item name="android:seekBarStyle">@style/SeekBarAppTheme</item> 
     <item name="android:listChoiceBackgroundIndicator">@drawable/apptheme_list_selector_holo_dark</item> 
     <item name="android:activatedBackgroundIndicator">@drawable/apptheme_activated_background_holo_dark</item> 
    </style> 

</resources> 

사람이 실제 문제가 여기에 무엇인지 말해 줄 수 있습니까? 가능한 해결책을 제안하십시오.

+0

당신은 로그 캣을 차단 한 것으로 보인다. 그 이상을 제공하십시오 –

+0

@ cricket_007 참조하십시오. 전체 logcat을 추가했습니다. – anuradha

+0

'원인 : java.lang.IllegalArgumentException : 디자인 라이브러리' –

답변

0

귀하의 HomeActivity exnteds AppCompatActivity, 그래서 AppTheme는 Theme.AppCompat로 활동 테마 또는 유사한 테마를 설정 Theme.AppCompat

https://developer.android.com/reference/android/support/v7/app/AppCompatActivity.html

상속합니다.

Android Holo Colors Generator에서 "APPCOMPAT"호환성을 선택하셨습니까?

enter image description here

+0

처음에는 내 minmum sdk가 15 였기 때문에 CompCompact로 AppCompact 테마를 선택하지 않았습니다.하지만 AppCompact에 대한 테마 compitability를 선택한 후에 내 문제가 해결되었습니다. 당신의 도움을 주셔서 감사합니다. – anuradha