staggeredgridlayout

Dynamically Setting a Fixed Height for a Staggered Grid View

六眼飞鱼酱① 提交于 2019-12-03 09:38:47
问题 I'm trying to take a RecyclerView with a StaggeredGridLayout and make it a fixed height by having it measure the views and set the height dynamically. I'm overriding the onMeasure() , but it does not always seem to measure correctly. I'd say it works about 50% of the time. The other 50% of the time it under measures it. I think it has to do with when the text wraps in the view_tile_small.xml , but I'm not sure. Fragment public class AtTheMuseumFragment extends Fragment implements

Setting span size of single row in StaggeredGridLayoutManager

眉间皱痕 提交于 2019-11-30 11:51:22
问题 I have a staggered grid that has 2 columns. This is working. What I want is at position 0 for the row to span across the 2 columns. I have done this before quite easily using GridLayoutManger as so: mGridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { return position == 0 ? 2 : 1; } }); StaggeredGridLayoutManager doesn't provide me with this functionality like GridLayoutManager does. Is there a different way of doing

How to implement Endless scrolling using StaggeredLayoutManager

本小妞迷上赌 提交于 2019-11-30 08:30:41
I already tried to implement the endless scrolling for LinearLayoutManager and it is successful and tried to copy the LinearLayoutManager implementation to StaggeredGridLayoutManager but it doesn't work. I just want to get the firstVisibleItem. in LinearLayoutManager : int firstVisibleItem = linearLayoutManager.findFirstVisibleItemPosition(int); but in StaggeredGridLayoutManager is : int firstVisibleItem = staggeredGridLayoutManager.findFirstVisibleItemPositions(int[]) How to get the firstVisibleItem using (int) not (int[])? Is there any good approach/implementation about this? Thanks in

Android: How to create a Facebook like images gallery grid?

喜欢而已 提交于 2019-11-30 05:32:38
I'm trying to implement a facebook like, gallery grid, where items have different sizes: I was trying to use different libraries/solutions but for now without success: I tried to use AsymemetricGridView . But the problem with this implementation is that there are empty dead spaces left in the grid after going throw the adapter. I also thought of using the StaggeredGridLayoutManager and a RecycleView , but items, in this case, don't have equal or half sizes to other items as it implemented in the Facebook gallery. Now I thinking of providing different view holders for different cases in the

Setting span size of single row in StaggeredGridLayoutManager

若如初见. 提交于 2019-11-30 01:35:48
I have a staggered grid that has 2 columns. This is working. What I want is at position 0 for the row to span across the 2 columns. I have done this before quite easily using GridLayoutManger as so: mGridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { return position == 0 ? 2 : 1; } }); StaggeredGridLayoutManager doesn't provide me with this functionality like GridLayoutManager does. Is there a different way of doing this? I have searched but not found anyone with the same problem, which is surprising as I would think

How to determine column position in staggered grid layout manager

霸气de小男生 提交于 2019-11-29 11:30:40
问题 I’m using a staggered recycler view layout for a list of photos. I want the spacing on the sides to be zero while still having space between the two columns. I’m using an item decoration sub class to get the spacing seen in the attached photo. I know I have control over the left and right spacing but the problem is that I never know which column the photo is in. It seems like the staggered layout manager does some of its own reordering. I've tried using getChildAdapterPosition but it seems to

How to implement Endless scrolling using StaggeredLayoutManager

。_饼干妹妹 提交于 2019-11-29 11:18:47
问题 I already tried to implement the endless scrolling for LinearLayoutManager and it is successful and tried to copy the LinearLayoutManager implementation to StaggeredGridLayoutManager but it doesn't work. I just want to get the firstVisibleItem. in LinearLayoutManager : int firstVisibleItem = linearLayoutManager.findFirstVisibleItemPosition(int); but in StaggeredGridLayoutManager is : int firstVisibleItem = staggeredGridLayoutManager.findFirstVisibleItemPositions(int[]) How to get the

Android: How to create a Facebook like images gallery grid?

梦想的初衷 提交于 2019-11-29 04:14:04
问题 I'm trying to implement a facebook like, gallery grid, where items have different sizes: I was trying to use different libraries/solutions but for now without success: I tried to use AsymemetricGridView. But the problem with this implementation is that there are empty dead spaces left in the grid after going throw the adapter. I also thought of using the StaggeredGridLayoutManager and a RecycleView , but items, in this case, don't have equal or half sizes to other items as it implemented in

RecyclerView onCreateViewHolder Return Type Incompatibility With Multiple Custom ViewHolders

心不动则不痛 提交于 2019-11-28 02:49:16
问题 I'm trying to use multiple ViewHolders in a RecyclerView in order to swap these views out at run time. I have created two classes which extend RecyclerView.ViewHolder: MenuItemViewHolder public class MenuItemViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { public TextView menuItemText; public ImageView menuItemPhoto; public RecyclerViewAdapter rva; public MenuItemViewHolder(View itemView) { super(itemView); itemView.setOnClickListener(this); rva = caller;

StaggeredGridLayoutManager and moving items

荒凉一梦 提交于 2019-11-27 11:23:05
I have created a very simple project, displaying 28 images with StaggeredGridLayoutManager by recyclerview. but as I scroll the recyclerview it moves items for example from left to right or swap the column of left and right. codes: import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.os.Bundle; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.StaggeredGridLayoutManager; public class MainActivity extends Activity { String mImageDir; private RecyclerView mRecyclerView; private StaggeredGridLayoutManager mLayoutManager;