什么source not found?在那儿报错的?

解决方案 »

  1.   

    起码source not found 人家会说那个source吧,
      

  2.   

    恩~在main.xml中没有加入<com.test.MyView 
        android:id="@+id/myview"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>时,没有问题,加了这句之后就有问题.
    是不是在程序里需要引入自定义的myview?否则引用不到资源。
    还是其他的原因?
      

  3.   

    http://student.csdn.net/space.php?uid=176474&do=blog&id=43508
    你的自定义的myview在程序中有没有写代码?# super(context, attr);  
    #         myPaint = new Paint();  
    #         TypedArray a = context.obtainStyledAttributes(attr, R.styleable.myView);//TypedArray是一个数组容器  
    #         float textSize = a.getDimension(R.styleable.myView_textSize, 30);//防止在XML文件里没有定义,就加上了默认值30  
    #         int textColor = a.getColor(R.styleable.myView_textColor, 0xFFFFFFFF);//同上,这里的属性是:名字_属性名  
    #         myPaint.setTextSize(textSize);  
    #         myPaint.setColor(textColor);  
    #         a.recycle();//我的理解是:返回以前取回的属性,供以后使用。以前取回的可能就是textSize和textColor初始化的那段