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.*;

搞定

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