public class DemoActivity extends FragmentActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo);
}
TextView textView = (TextView) findViewById(R.id.demo1);
textview.setText("hi");
它不会识别 textView,然后我不能使用它的方法,所以我不能继续。可能会发生什么?
布局是:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/demo1"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>