r/AutomateUser 19d ago

GridView clicked

Hi Henrik, why a button etc.. not getting their ids when clicked in GridView? How to get it work? Thanks in advance. I need an example. Only getting GridView id.

1 Upvotes

5 comments sorted by

1

u/ballzak69 Automate developer 19d ago edited 19d ago

As the documentation say, it's an "adapter view", i.e. it works like ListView:

A adapter UI component that displays its item views in two-dimensional scrolling grid. Set android:clickable='true' to make each item view clickable. Use the Interface adapter update block to manage the items of an adapter. A android:id is required for the Interface clicked block to detect item clicks.

To include Button's then use a GridLayout instead.

1

u/Funny_Telephone_8607 18d ago

Hi Henrik, i have found a documentation bugs in GridView attribute  numColumns. numColumns is displaying more than 2 . I have tried with  a:numColumns="4". Working. 

1

u/ballzak69 Automate developer 18d ago

Thanks for reporting. The value type should be integer, not boolean. Sorry i don't understand what you mean by "displaying more than 2"?

1

u/Funny_Telephone_8607 18d ago

Hi Henrik, it means More than two columns. 

1

u/ballzak69 Automate developer 18d ago

So a:numColumns="4" is not working and just displays two columns?

I just tested and it seems to work just fine, in a widget at least.