app:layout_behavior 增加后报错,不加不出现效果

来源:10-9 沉浸式状态栏和渐变透明顶栏解决方案和封装

悟空工作室

2018-08-28

报错日志

写回答

2回答

傅猿猿

2018-08-29

layout_behavior是通过反射去寻找类的,至少目前本质上是这样,报错信息显示的是没有找到这个对应的类,所以喽,你得看看是不是把Behavior完整的类名写对了,是完整的类名,包括包名的那种

0
4
悟空工作室
还有一个问题,我的界面启动后toolbar是带着颜色的,不是透明的,请问是什么原因呢。
2018-08-30
共4条回复

悟空工作室

提问者

2018-08-28

08-28 23:44:09.426 12340-12340/com.wukongwork.ec E/AndroidRuntime: FATAL EXCEPTION: main

    Process: com.wukongwork.ec, PID: 12340

    java.lang.NoClassDefFoundError: android.widget.Toolbar

        at com.wukongwork.ec.main.index.TranslucentBehavior.layoutDependsOn(TranslucentBehavior.java:13)

        at android.support.design.widget.CoordinatorLayout$LayoutParams.dependsOn(CoordinatorLayout.java:3009)

        at android.support.design.widget.CoordinatorLayout.prepareChildren(CoordinatorLayout.java:679)

        at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:739)

        at android.view.View.measure(View.java:16879)

        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5406)

        at android.widget.FrameLayout.onMeasure(FrameLayout.java:332)

        at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)

        at android.view.View.measure(View.java:16879)

        at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:818)

        at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:495)

        at android.view.View.measure(View.java:16879)

        at android.support.constraint.ConstraintLayout.internalMeasureChildren(ConstraintLayout.java:1212)

        at android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:1552)

        at android.view.View.measure(View.java:16879)

        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5406)

        at android.widget.FrameLayout.onMeasure(FrameLayout.java:332)

        at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)

        at android.view.View.measure(View.java:16879)

        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5406)

        at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:401)

        at android.view.View.measure(View.java:16879)

        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5406)

        at android.widget.FrameLayout.onMeasure(FrameLayout.java:332)

        at android.view.View.measure(View.java:16879)

        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5406)

        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1616)

        at android.widget.LinearLayout.measureVertical(LinearLayout.java:729)

        at android.widget.LinearLayout.onMeasure(LinearLayout.java:601)

        at android.view.View.measure(View.java:16879)

        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5406)

        at android.widget.FrameLayout.onMeasure(FrameLayout.java:332)

        at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2369)

        at android.view.View.measure(View.java:16879)

        at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2439)

        at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1385)

        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1655)

        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1262)

        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6400)

        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:788)

        at android.view.Choreographer.doCallbacks(Choreographer.java:591)

        at android.view.Choreographer.doFrame(Choreographer.java:560)

        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:774)

        at android.os.Handler.handleCallback(Handler.java:808)

        at android.os.Handler.dispatchMessage(Handler.java:103)

        at android.os.Looper.loop(Looper.java:193)

        at android.app.ActivityThread.main(ActivityThread.java:5322)

        at java.lang.reflect.Method.invokeNative(Native Method)

        at java.lang.reflect.Method.invoke(Method.java:515)

        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)

        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)

        at dalvik.system.NativeStart.main(Native Method)


0
0

Android通用框架设计与完整电商App开发

从第一行代码开始教你,通用且一键式配置的框架设计并轻松实现完整电商App

2028 学习 · 1182 问题

查看课程