定义了一个继承了TextView的类LrcView作为自定义控件,在xml文件也写好了。这是部分代码<LinearLayout 
        android:layout_weight="1"
        android:orientation="vertical"
        android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:background="@drawable/backcolor"
        >
        <turr.view.LrcView
        android:id="@+id/LyricShow"
        android:layout_width="fill_parent"
     android:layout_height="fill_parent"
        >
      </turr.view.LrcView>
    </LinearLayout>当我传参到LrcView的对象时,会抛出NullPointerException异常,说不能启动activity,不传参LinearLayout能显示背景颜色,谁能告诉下我?

解决方案 »

  1.   

    我定义的布局文件是play.xml还有看网上的文章,看到这样的话“我仍然以默认的main.xml文件定义具体的空间而置自定义的View于不顾,自然在运行时,在默认的布局中找不到我定义的控件”,原文是:http://hi.baidu.com/lovewjlove/blog/item/cf2b6289677fbba40e244448.html不知道是不是这个原因
      

  2.   

    android:id="@+id/LyricShow"
      建议将id 改成 短线连接不要使用大写的 如lyric_show