Android - Gridlayout android.support.v7.widget.GridLayout cannot be cast to android.widget.GridLayout

后端 未结 7 1622
说谎
说谎 2020-12-01 20:15

I want to create a GridLayout able to run in all the APIs.

The thing is, when i use GridLayout instead of android.support.v7.widget.GridLayo

相关标签:
7条回答
  • 2020-12-01 21:17

    Yes from your error log ,

    android.support.v7.widget.GridLayout cannot be cast to android.widget.GridLayout
                          at devector.dom.gridtest.MainActivity.onCreate(MainActivity.java:21)
    

    you can change your casting like this way to solve your problem

    android.support.v7.widget.GridLayout grid = (android.support.v7.widget.GridLayout)findViewById(R.id.grid);
    
    0 讨论(0)
提交回复
热议问题