我收到错误
"Caused by: java.lang.ClassCastException: androidx.gridlayout.widget.GridLayout cannot be cast to android.widget.GridLayout", in mainActivity.java
GridLayout mygridLayout = findViewById(R.id.gridLayout);
for(int i=0; i<mygridLayout.getChildCount(); i++)
{
((ImageView) mygridLayout.getChildAt(i)).setImageResource(0);
}
最佳答案
改变
import android.widget.gridLayout
至
import androidx.gridlayout.widget.GridLayout;
你的代码会起作用
关于java - androidx.gridlayout.widget.GridLayout 无法转换为 android.widget.GridLayout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59195798/