TextView onMeasure导致NullPointerException

时间:2015-07-20 03:11:53

标签: android textview

我有一个由我的项目中的硬编码创建的布局,我已经看到了一些类似下面的日志,但是我无法重新出现。我在TextView中有setLayoutParams(),但它没用。这个布局是一个详细信息页面,我已经为这些视图定义了一些ID,我已经将这个布局复制到另一个详细信息页面,所以这两个页面的视图使用了相同的ID,并且布局相同,这是否有冲突?我需要一些帮助,THX!

java.lang.NullPointerException at android.widget.TextView.onMeasure(TextView.java:6559) at android.view.View.measure(View.java:16552) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5130) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404) at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1052) at android.widget.LinearLayout.onMeasure(LinearLayout.java:590) at android.view.View.measure(View.java:16552) at android.widget.RelativeLayout.measureChild(RelativeLayout.java:689) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:473) at android.view.View.measure(View.java:16552) at android.widget.RelativeLayout.measureChild(RelativeLayout.java:689) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:473) at android.view.View.measure(View.java:16552) at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1226) at android.widget.LinearLayout.onMeasure(LinearLayout.java:590) at android.view.View.measure(View.java:16552) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5130) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404) at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) at android.view.View.measure(View.java:16552) at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1226) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.widget.ScrollView.onMeasure(ScrollView.java:326) at android.view.View.measure(View.java:16552) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455) at android.view.View.measure(View.java:16552) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5130) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.java:16552) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5130) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404) at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) at android.view.View.measure(View.java:16552) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455) at android.view.View.measure(View.java:16552) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455) at android.view.View.measure(View.java:16552) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5130) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.java:16552) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5130) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404) at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) at android.view.View.measure(View.java:16552) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5130) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2340) at android.view.View.measure(View.java:16552) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1927) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1124) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1306) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1011) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5638) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:786) at android.view.Choreographer.doCallbacks(Choreographer.java:591) at android.view.Choreographer.doFrame(Choreographer.java:560) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:772) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5143) 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:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602) at dalvik.system.NativeStart.main(Native Method)

0 个答案:

没有答案