针对异常java.lang.IllegalStateException onMeasure() did not set the measured dimension解决方法
来源:互联网 发布:适合女生看的a v 知乎 编辑:程序博客网 时间:2024/05/22 12:32
针对异常java.lang.IllegalStateException onMeasure() did not set the measured dimension by calling setMeasuredDimension()的解决办法:
versionName = 2.5.2 versionCode = 20002100
java.lang.IllegalStateException onMeasure() did not set the measured dimension by calling setMeasuredDimension()
View.java 17945
java.lang.IllegalStateException: onMeasure() did not set the measured dimension by calling setMeasuredDimension()
at android.view.View.measure(View.java:17945)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
at android.view.View.measure(View.java:17915)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
at android.view.View.measure(View.java:17915)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
at com.android.camera.ui.MainActivityLayout.onMeasure(MainActivityLayout.java:152)
at android.view.View.measure(View.java:17915)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
at android.view.View.measure(View.java:17915)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1692)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:760)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
at android.view.View.measure(View.java:17915)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2810)
at android.view.View.measure(View.java:17915)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2472)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2164)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1303)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6666)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:800)
at android.view.Choreographer.doCallbacks(Choreographer.java:603)
at android.view.Choreographer.doFrame(Choreographer.java:572)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:786)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5699)
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:984)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
解决办法:
增加setMeasuredDimension调用
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (mNonDecorWindowSizeChangedListener != null) {
mNonDecorWindowSizeChangedListener.onNonDecorWindowSizeChanged(
MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec),
CameraCommonUtil.getDisplayRotation(getContext()));
}
setMeasuredDimension(widthMeasureSpec, heightMeasureSpec);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
关于此问题的根本原因以及View.Measure 函数的详细说明可以参考:http://blog.csdn.net/lilybaobei/article/details/8021868
versionName = 2.5.2 versionCode = 20002100
java.lang.IllegalStateException onMeasure() did not set the measured dimension by calling setMeasuredDimension()
View.java 17945
java.lang.IllegalStateException: onMeasure() did not set the measured dimension by calling setMeasuredDimension()
at android.view.View.measure(View.java:17945)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
at android.view.View.measure(View.java:17915)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
at android.view.View.measure(View.java:17915)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
at com.android.camera.ui.MainActivityLayout.onMeasure(MainActivityLayout.java:152)
at android.view.View.measure(View.java:17915)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
at android.view.View.measure(View.java:17915)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1692)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:760)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
at android.view.View.measure(View.java:17915)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2810)
at android.view.View.measure(View.java:17915)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2472)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2164)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1303)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6666)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:800)
at android.view.Choreographer.doCallbacks(Choreographer.java:603)
at android.view.Choreographer.doFrame(Choreographer.java:572)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:786)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5699)
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:984)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
解决办法:
增加setMeasuredDimension调用
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (mNonDecorWindowSizeChangedListener != null) {
mNonDecorWindowSizeChangedListener.onNonDecorWindowSizeChanged(
MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec),
CameraCommonUtil.getDisplayRotation(getContext()));
}
setMeasuredDimension(widthMeasureSpec, heightMeasureSpec);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
关于此问题的根本原因以及View.Measure 函数的详细说明可以参考:http://blog.csdn.net/lilybaobei/article/details/8021868
0 0
- 针对异常java.lang.IllegalStateException onMeasure() did not set the measured dimension解决方法
- java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive
- java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive
- java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive
- java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive
- java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receiv
- java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive
- java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receiv
- java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive
- java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive
- java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive
- java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive
- linux sonar启动 java.lang.IllegalStateException: Webapp did not start
- java.lang.IllegalStateException 异常
- 异常:java.lang.IllegalStateException
- android 6.0+ java.lang.IllegalStateException did not call finish() prior to onResume() completing
- 异常:java.lang.IllegalStateException: Cannot deactivate transaction synchronization - not active
- android java.lang.IllegalStateException: database not open解决方法
- 课程练习一Problem F
- 并发编程经历:同步加锁之业务锁
- squid源码分析2—refresh_pattern机制分析
- python学习4:获取豆瓣上映电影数据
- squid源码分析3—purge流程分析
- 针对异常java.lang.IllegalStateException onMeasure() did not set the measured dimension解决方法
- l.ExecException: Process 'command 'C:\Java\jdk1.8.0_45\bin\java.exe'' 错误
- oracle 一些用到过的表空间操作命令
- 疯子求助-梧桐雨解答的jsp proxy
- Mac快捷键大全
- 2016.3.29 360c++ 研发编程第二题
- 链表基本操作复习
- PHP的Memcache扩展的安装和使用
- 【NGUI】NGUI英文单词换行错误