2016-01-26 68 views
1

我正在使用android studio中的GridView。 当我初始化GridView,我得到一个类型转换错误:类型转换Android无法将Android .view.View转换为GridView

Inconvertible types; cannot cast 'android.view.View' to 'com.example.pageviewer.GridView'

你可以在任何一个请。由于提前

enter image description here

+0

检查你的xml文件或添加xml文件 – Pavya

+0

什么是你的gridview参考? (例如导入android.widget.GridView) – Webster

+0

只需重命名您的类名即可。你不应该从AppCompatActivity扩展GridView – Mann

回答

2

重命名你的GridView类GridViewActivity,问题也就解决了。

+0

谢谢感谢@ g2o –

相关问题