报错如下:
09-21 15:48:47.636 18649-18649/ E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: , PID: 18649 java.lang.NullPointerException at android.widget.TextView.makeNewLayout(TextView.java:6346) at android.widget.TextView.onMeasure(TextView.java:6631) at android.view.View.measure(View.java:16935) at android.widget.Spinner.setUpChild(Spinner.java:650) at android.widget.Spinner.makeView(Spinner.java:613) at android.widget.Spinner.getBaseline(Spinner.java:449) at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1089) at android.widget.TableRow.onMeasure(TableRow.java:114) at android.view.View.measure(View.java:16935) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5156) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404) at android.widget.TableLayout.measureChildBeforeLayout(TableLayout.java:464) at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) at android.widget.TableLayout.measureVertical(TableLayout.java:476) at android.widget.TableLayout.onMeasure(TableLayout.java:439) at android.view.View.measure(View.java:16935) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5156) 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:16935) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5156) 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:16935) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5156) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.java:16935) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2274) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1153) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1523) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1040) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6147) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761) at android.view.Choreographer.doCallbacks(Choreographer.java:574) at android.view.Choreographer.doFrame(Choreographer.java:544) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747) 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:5114) 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)
原因是textview用到了android:ellipsize属性,导致报了空指针,去掉这个属性就可以了。