Android: Showing cards like layout as in Google Keep
android, android-layout, gridview
Solution
They surely do not use a GridView for google Keep - but probably an Adapter nonetheless.
To use different Views with your Adapter you can use different View types:
- Override `getViewTypeCount()` to return the number of View types you support.
- Return the appropriate type in `getItemViewType(int position)` for this specific item.
- Create the correct View in `getView(int position, View convertView, ViewGroup parent)`.
Keep in mind that the rules for recycling, ViewHolder and so on still apply. For multiple types recycling only happens for the correct type.
Marcus Körner shared a gist by Jake Wharton on G+ recently that might be useful.
Problem
I was wondering how to show the snapshot of my notes, checklists, images in the grid view. I have no trouble creating the grid view but creating a preview of it is the challenge I'm facing right now as I need to add different type of views(text, checklist, imageview) to the grid according to their time of creation. Works fine for a single type of view like image or text only. Or in other words. How do I add the different views dynamically to the GridView Adapter? All or any help is appreciated. Thanks.