gridView = findViewById(R.id.gridView1);为什么这句出错呢?
package com.example.firstandroidapp;
import android.app.Activity;
import android.os.Bundle;
public class GridView extends Activity {
private GridView gridView;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gridview);
gridView = (GridView)findViewById(R.id.gridView1);
}
}
提示我出错呢?错误提示是:Cannot cast from View to GridView。我XML文件里面也是有GridView的。奇怪了