textview cannot be resolved to a type 解决方法

        今天刚开始看Android,也跟着写了个activity测试下,但却发生错误:"textview cannot be resolved to a type“在
TextView myTextView=(TextView)this.findViewById(R.id.myTextView);
Button myButton=(Button)this.findViewById(R.id.myButton);

之后看了下配套的代码,才知道原来发现缺少了两个包,于是加上
import android.widget.Button;
import android.widget.TextView;

或者

import android.widget.*;

搞定

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章