在安卓编译时 出现这种错误怎么班 TextView cannot be resolved to a type!! 具体如下
packagecom.example.cba;importandroid.os.Bundle;importandroid.app.Activity;importandro...
package com.example.cba;import android.os.Bundle;import android.app.Activity;import android.view.Menu;public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView myTextView = (TextView)findViewById(R.id.myTextView); Button myButton = (Button)findViewById(R.id.myButton); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; }}
展开
1个回答
2013-07-16
展开全部
你把activity_main.xml看看吧,可能是你把myTextView放置的位置不正确
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询