打开包含“折叠”工具栏的片段时显示错误

时间:2017-01-31 12:21:25

标签: android android-collapsingtoolbarlayout

打开包含“折叠”工具栏的片段时会显示错误。是否有任何已知的支持库问题或可能导致此问题的其他问题?

android.view.InflateException: Binary XML file line #13: Binary XML file line #13: Error inflating class android.support.design.widget.CollapsingToolbarLayout
    at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
    at nyedusoft.i_soft_r.Account.ProfileFragment.onCreateView(ProfileFragment.java:48)
    at android.support.v4.app.Fragment.performCreateView(Fragment.java:2074)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1286)
    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:758)
    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1671)
    at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:532)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
 Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class android.support.design.widget.CollapsingToolbarLayout
    at android.view.LayoutInflater.createView(LayoutInflater.java:645)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
    at nyedusoft.i_soft_r.Account.ProfileFragment.onCreateView(ProfileFragment.java:48) 
    at android.support.v4.app.Fragment.performCreateView(Fragment.java:2074) 
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104) 
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1286) 
    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:758) 
    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1671) 
    at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:532) 
    at android.os.Handler.handleCallback(Handler.java:739) 
    at android.os.Handler.dispatchMessage(Handler.java:95) 
    at android.os.Looper.loop(Looper.java:148) 
    at android.app.ActivityThread.main(ActivityThread.java:5417) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
 Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at android.view.LayoutInflater.createView(LayoutInflater.java:619)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
    at nyedusoft.i_soft_r.Account.ProfileFragment.onCreateView(ProfileFragment.java:48) 
    at android.support.v4.app.Fragment.performCreateView(Fragment.java:2074) 
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104) 
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1286) 
    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:758) 
    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1671) 
    at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:532) 
    at android.os.Handler.handleCallback(Handler.java:739) 
    at android.os.Handler.dispatchMessage(Handler.java:95) 
    at android.os.Looper.loop(Looper.java:148) 
    at android.app.ActivityThread.main(ActivityThread.java:5417) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
 Caused by: java.lang.NoSuchMethodError: No static method setLayoutDirection(Landroid/graphics/drawable/Drawable;I)V in class Landroid/support/v4/graphics/drawable/DrawableCompat; or its super classes (declaration of 'android.support.v4.graphics.drawable.DrawableCompat' appears in /data/app/nyedusoft.i_soft_r-2/base.apk)
    at android.support.design.widget.CollapsingToolbarLayout.setStatusBarScrim(CollapsingToolbarLayout.java:663)
    at android.support.design.widget.CollapsingToolbarLayout.<init>(CollapsingToolbarLayout.java:197)
    at android.support.design.widget.CollapsingToolbarLayout.<init>(CollapsingToolbarLayout.java:132)
    at java.lang.reflect.Constructor.newInstance(Native Method) 
    at android.view.LayoutInflater.createView(LayoutInflater.java:619) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
    at 

1 个答案:

答案 0 :(得分:0)

如果你想使用coordinateLayout,你必须在你的gradle中添加设计库

compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'