Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:在SDK 4.2中调用View.layout()时崩溃_Android - Fatal编程技术网

Android:在SDK 4.2中调用View.layout()时崩溃

Android:在SDK 4.2中调用View.layout()时崩溃,android,Android,我编写了一个应用程序,在其中我调用child.layout(),其中“child”是一个FrameLayout,然后我在SDK2.2手机上运行它,没问题;但当我在SDK4.1 pad上运行它时,它崩溃了 class Child extends FrameLayout{ .... } class B extends ViewGroup { Child c = new Child(); c.mesure(); c.layout();//crashed here on Androi

我编写了一个应用程序,在其中我调用child.layout(),其中“child”是一个FrameLayout,然后我在SDK2.2手机上运行它,没问题;但当我在SDK4.1 pad上运行它时,它崩溃了

class Child extends FrameLayout{
 ....
}
class B extends ViewGroup {
 Child c = new Child();
    c.mesure();
    c.layout();//crashed here on Android4.2

}
请帮帮我


提前谢谢。

您能在这里添加代码吗?还将显示崩溃的堆栈跟踪interesting@g00dy示例:类子级扩展FrameLayout{…};然后在我调用“child.mesuare();child.layout()”的某个地方,它在SDK4.2上崩溃了,但在SDK2.2上没有崩溃。@ligi是的,我知道,堆栈跟踪说:空指针异常,当调用ViewGroup.layout(),View.setFrame(),Vew.onLayout(),View.invalidate()……这是一团乱麻,在问题中写代码,以及LogCat,我们需要将所有这些设置到位,以查看可能出现的错误。