android-gridview
gridView with different cells sizes, pinterest style
Is it a bit late to answer? check this library from etsy. it looks very promising. https://github.com/etsy/AndroidStaggeredGrid I think it is newer version of https://github.com/maurycyw/StaggeredGridView . Updated. Try using RecyclerView StaggeredGridLayoutManager from google instead RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view); recyclerView.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(adapter);
How to fully replace listView/GridView with RecyclerView?
ok, I think I’ve found some solutions to what I wrote about: dividers – the links I’ve given can probably help (here, here and here). “footerDividersEnabled” – probably like #1, but even if you don’t have it, you could always add a divider to the layout of the footer. “headerDividersEnabled” – same as #2. “listSelector” … Read more
GridView rows overlapping: how to make row height fit the tallest item?
I used a static array to drive max heights for the row. This is not perfect since the earlier columns will not be resized until the cell is redisplayed. Here is the code for the inflated reusable content view. Edit: I got this work correctly but I had pre-measure all cells before rendering. I did … Read more
RecyclerView Item Click Listener the Right Way
You need to check this tutorial here for better understanding on how you can achieve the behaviour that you want. In case of handling the onClickListener from your activity you need to work based on a callback implementation with an interface. Pass the interface from the activity to your adapter and then call the callback … Read more
How ListView’s recycling mechanism works
Initially, I was also unaware of listview recycling and the convertview usage mechanism, but after a whole days research I pretty much understand the mechanisms of the list view by referring to an image from android.amberfog Whenever your listview is filled by an adapter it basically shows the number of Rows that the listview can … Read more
Gridview with two columns and auto resized images
Here’s a relatively easy method to do this. Throw a GridView into your layout, setting the stretch mode to stretch the column widths, set the spacing to 0 (or whatever you want), and set the number of columns to 2: res/layout/main.xml <?xml version=”1.0″ encoding=”utf-8″?> <FrameLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent”> <GridView android:id=”@+id/gridview” android:layout_width=”match_parent” android:layout_height=”match_parent” android:verticalSpacing=”0dp” android:horizontalSpacing=”0dp” android:stretchMode=”columnWidth” … Read more
GridLayout (not GridView) how to stretch all children evenly
Starting in API 21 the notion of weight was added to GridLayout. To support older android devices, you can use the GridLayout from the v7 support library. The following XML gives an example of how you can use weights to fill the screen width. <?xml version=”1.0″ encoding=”utf-8″?> <android.support.v7.widget.GridLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:grid=”http://schemas.android.com/apk/res-auto” android:id=”@+id/choice_grid” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:layout_centerHorizontal=”true” android:padding=”4dp” … Read more
GridView VS GridLayout in Android Apps
A GridView is a ViewGroup that displays items in two-dimensional scrolling grid. The items in the grid come from the ListAdapter associated with this view. This is what you’d want to use (keep using). Because a GridView gets its data from a ListAdapter, the only data loaded in memory will be the one displayed on … Read more