Create custom Gridview with images of variable width and height - android

I want to create Grid view like Google plus which arranges images in variable width and height in the layout. For example say i have 7 images, and these images should be arranged in the grid view( Not in regular grid view but with variable rows and columns). These images should change their position in grid view after sometime say 5 seconds.

Related

Auto resize item with grid layout manager in recycler view

Main target is to make grid layout like Google Meet or What'sapp group call
If there is a single person it should occupy all the space
Single item getting all space
All the items should be equally arranged and with equal height and width and restrict item to move out of recycler view
Auto resize image height and restrict recycler view scrolling

Is it possible to have a vertical recycler view with different widths for each row?

I am creating a recycler view and I have 2 types of itemviews in it. Each item view would have different widths(55dp for one and MatchParent for the another). If I create a recycler view with first 4 rows having width 55dp and the next 2 rows with width MatchParent, do you think my entire recycler view would have same width throughout? Or will it be 55 width for first 4 rows and MatchParent for the last 2 rows?
Please note I have set the width and height as wrapContent for the recycler view and using staggeredGridLayoutManager with single column and vertical scroll.
I only want a single column vertical scrolling recycler view with different widths at each row.
If you can imagine, it should look like an L - shaped recycler view.
Yes, it is possible to have items in RecyclerView to have different height and width.
You should give wrap content for both list item and RecyclerView

Nested RecyclerView with wrap_content and without nested scrolling

Is it possible to have a nested RecyclerViews with following criterias?
The outer RecyclerView is attached programmatically near the top of the view hierarchy of the Activity
The outer RecyclerView is scrollable
The inner RecyclerView lives inside a custom view which is also attached programatically
The inner RecyclerView has a vertical GridLayout with ImageViews
The inner RecyclerView has width match_parent and height wrap_content
The inner RecyclerView is not scrollable
The inner RecyclerView can displays all it's elements by scrolling the outer RecyclerView
The items inside the RecyclerView are recycled correctly
I am trying to build this but the last two criterias are not satisfied. If I have more than 30 Images (GridLayout has 3 columens, so I have minimum 10 rows) further images are not displayed. And if I open the HierarchyViewer I see that the RecyclerView contains all the inner ViewHolders so nothing is recycled, even if i scroll down.
Furthermore I have questions towards the Images within the grid of the RecyclerView. want to calculate their width dynamically and the images are loaded with Glide Library. I make a request to a server which gives me the images in the right width, but the surrounding ImageViewa have 2 dp less than the images themselves. I have a grid spacing of 8dp. I calculate the width of the images(to be requested) with this formula:
imageWidth = (screenWidth - 2 * horizontalActivityPadding - 2 * spacing) / 3;
This should work for a GridLayout with 3 columns. But then the imageWidth has 90dp and the ImageView's width becomes 88dp. This is because I get a spacing after the 3rd column. But I only calculated twice the spacing so I expect to have this spacing only
between the 1st and the 2nd column
and between the 2nd and the 3rd column
but not after the 3rd column
What may be the reasons for
my RecyclerView problem?
my image spacing problem?

Android Gridview with fixed no of rows and columns

I want to create a grid that contains same no of columns and rows. If i assign 6 to gridview then it should generate 6 no of columns and 6 no of rows which means 36 imageviews and Gridview should not scroll down. All imageviews should fit the gridview. Size of imageviews in the grid is same (both width and height) like a calender.

grid view picture puzzle formation error in android

i.setLayoutParams(new GridView.LayoutParams(iwidth , iheight ));
i.setImageBitmap(duplicate.get(arg0));
i.setPadding(1, 1, 1, 1);
I am using the above to provide spaces actually i'm splitting an image and using gridview for placing the splitted images in gridview allowing the user to play picture puzzle in grid view but the splitted images are not fitted exactly in grid view the moddle row images are shrink and the right side images are enlarged one more issue is spacing between them ,it is providing spaces as from one row to next row but it's not providing spaces column to column can any one help me
I just looked at the docs and there's a setVerticalSpacing() and a setHorizontalSpacing() methods. Check them out.
So instead of setting the spacing in the ImageView, you can set it at the grid level.

Categories

Resources