FrameLayout的android:layout_height属性设置为dimen文件中的参数报错

以上是通知栏布局最外层用FrameLayout表示的正确代码,但如果把android:layout_height设置为@demen表示的参数,则即使此参数存在也会报如下错误,要求“You must supply a layout_height attribute”。

错误如下:
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: couldn't inflate view for notification com.abc/0x2

01-03 13:59:51.189 2586 2586 E PhoneStatusBar: java.lang.RuntimeException: Binary XML file line #2: You must supply a layout_height attribute.
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:5644)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at android.view.ViewGroup$LayoutParams.(ViewGroup.java:5596)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at com.android.internal.widget.SizeAdaptiveLayout$LayoutParams.(SizeAdaptiveLayout.java:335)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at com.android.internal.widget.SizeAdaptiveLayout.generateLayoutParams(SizeAdaptiveLayout.java:284)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at com.android.internal.widget.SizeAdaptiveLayout.generateLayoutParams(SizeAdaptiveLayout.java:51)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at android.view.LayoutInflater.inflate(LayoutInflater.java:477)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at android.widget.RemoteViews.apply(RemoteViews.java:2283)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at com.android.systemui.statusbar.phone.PhoneStatusBar.inflateViews(PhoneStatusBar.java:4844)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at com.android.systemui.statusbar.phone.PhoneStatusBar.addNotificationViews(PhoneStatusBar.java:2137)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at com.android.systemui.statusbar.phone.PhoneStatusBar.addNotification(PhoneStatusBar.java:2015)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at com.android.systemui.statusbar.CommandQueue$H.handleMessage(CommandQueue.java:340)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at android.os.Handler.dispatchMessage(Handler.java:99)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at android.os.Looper.loop(Looper.java:137)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at android.app.ActivityThread.main(ActivityThread.java:5083)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at java.lang.reflect.Method.invokeNative(Native Method)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at java.lang.reflect.Method.invoke(Method.java:511)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-03 13:59:51.189 2586 2586 E PhoneStatusBar: at dalvik.system.NativeStart.main(Native Method)

01-03 13:59:51.189 2586 2586 W PhoneStatusBar: removeNotification for unknown key: android.os.BinderProxy@430a0aa0


具体原因暂时不明,可能是存在height冲突。原因还有待进一步研究。

你可能感兴趣的:(FrameLayout的android:layout_height属性设置为dimen文件中的参数报错)