gridlayoutmanager

How can I fill RecyclerView with GridLayoutManager from right to left

只愿长相守 提交于 2019-11-26 10:01:40
问题 I\'m trying to fill some data into a RecyclerView with GridLayoutManager : GridLayoutManager layoutManager = new GridLayoutManager(this, 3, GridLayoutManager.VERTICAL, false); This will fill the data into the grid from left to right . The first item will be put into top-left place, etc. But the app I\'m developing is designed for an RTL language, so I need to make it fill from right to left . I tried to change the last argument to true . But it just scrolled the RecyclerView all the way down.

RecyclerView GridLayoutManager: how to auto-detect span count?

老子叫甜甜 提交于 2019-11-26 08:43:29
问题 Using the new GridLayoutManager: https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager.html It takes an explicit span count, so the problem now becomes: how do you know how many \"spans\" fit per row? This is a grid, after all. There should be as many spans as the RecyclerView can fit, based on measured width. Using the old GridView , you would just set the \"columnWidth\" property and it would automatically detect how many columns fit. This is basically what I

Drag and drop items in RecyclerView with GridLayoutManager

為{幸葍}努か 提交于 2019-11-26 06:19:46
问题 What I want to achieve: Have a RecyclerView with GridLayoutManager that supports drag\'n\'drop and that rearranges the items while dragging. Side note: First time developing anything with drag and drop. There are a lot of topics on how to achieve this feature using a ListView, for example: https://raw.githubusercontent.com/btownrippleman/FurthestProgress/master/FurthestProgress/src/com/anappforthat/android/languagelineup/DynamicListView.java However the examples are usually a lot of code with

Android Recyclerview GridLayoutManager column spacing

风流意气都作罢 提交于 2019-11-26 01:48:18
问题 How do you set the column spacing with a RecyclerView using a GridLayoutManager? Setting the margin/padding inside my layout has no effect. 回答1: RecyclerViews support the concept of ItemDecoration: special offsets and drawing around each element. As seen in this answer, you can use public class SpacesItemDecoration extends RecyclerView.ItemDecoration { private int space; public SpacesItemDecoration(int space) { this.space = space; } @Override public void getItemOffsets(Rect outRect, View view

Android Recyclerview GridLayoutManager column spacing

青春壹個敷衍的年華 提交于 2019-11-25 23:22:22
How do you set the column spacing with a RecyclerView using a GridLayoutManager? Setting the margin/padding inside my layout has no effect. ianhanniballake RecyclerViews support the concept of ItemDecoration : special offsets and drawing around each element. As seen in this answer , you can use public class SpacesItemDecoration extends RecyclerView.ItemDecoration { private int space; public SpacesItemDecoration(int space) { this.space = space; } @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { outRect.left = space; outRect.right =

Simple Android grid example using RecyclerView with GridLayoutManager (like the old GridView)

こ雲淡風輕ζ 提交于 2019-11-25 22:43:25
问题 I know that RecyclerView has replaced the functionality of the old ListView and GridView . I am looking for a very basic example that shows a minimal grid setup using RecyclerView . I am not looking for long tutorial style explanations, just a minimal example. I imagine the simplest grid that mimics the old GridView would consist of the following features: multiple cells per row single view in each cell responds to click events 回答1: Short answer For those who are already familiar with setting