Add view between 2 rows Gridview

前端 未结 3 409
耶瑟儿~
耶瑟儿~ 2020-12-30 12:07

I have a GridView, with 3 elements per row, and when I click on an item, a new view comes below the row. It\'s a bit like a folder application on iOS. I didn\'t find any ans

3条回答
  •  被撕碎了的回忆
    2020-12-30 12:58

    Although obviously there's no native component to accomplish what you want to do here, there's several ways to get the effect you want by combining other methods.

    One way i can think of is by creating your own Adapter and add the functionality to insert 3 more elements below the row clicked tagged with some kind of enum so you can differentiate it from the regular view, of course at the getView method of the Adapter, you will have to do the validation to know which view to inflate and return, after refreshing the view those 3 elements will be inserted below the clicked element and of course you can get rid of them by modifying the list the adapter is displaying. (This approach requires quite good knowledge of custom adapters, i've done something like this and is a clean and good approach).

    Another approach to this issue which is not as good as the first one however would absolutely do the trick is by, creating kind of a "Template" of the Effect that you want to get (like the one in the picture you have), keep that template as part of the activity on top of your grid view invisible, once someone taps on a element, fill the template accordingly to the info you want to show, make the grid invisible and bring the "template" visible on top of the grid, with the info that you want to show properly filled, the user wouldn't notice the change and when you want to go back to the grid view, just remove this "template" view and it will do the effect of having the grid the way it originally was.

    Hope this helps.

    Regards!

提交回复
热议问题