How to populate gridview in XML

I have a gridview that just needs to hold 4 buttons, and as soon as I continue to get an operation that is not supported when AdapterView fails during execution. Can you populate gridview through xml?

+4
source share
1 answer

You cannot add children to a GridView in XML. You need to create the appropriate Adapter and bind it to the GridView via setAdapter() .

Most likely, if you have only four buttons, you do not want the GridView in the first place.

+8
source

Source: https://habr.com/ru/post/1335335/


All Articles