How to create NxN non scrollable grid? - android

How can I create NxN grid which automatically scale its items to fit entire screen? I need something similar to GridView but without scrolling. I want to have all items visible and fit to screen dimensions.

Well you can get the size that the gridView can fit to, and then set each of the gridView's views size according to it.
This way, there will not have to be a scrolling at all.
So, for example, if you need an NxN grid and you have 100Nx100N pixels available, for each item give 100x100 pixels.
Of course, you might want to add some padding or separators between them, but that's the basic idea.
In order to get the gridView's size (so that you can set the size of each of its views), you can use this sample code I've made, which works on any type of view.

Related

Adjust a horizontal recyclerview so the last visible item is partially visible?

I am thinking of adjusting the width of each item a bit dynamically depending on screen size and number of items, but i am not able to find an easy solution to test it on different screen sizes. Is there an easier way?

How can i make a image grid with different heights and fixed width like Offer up app?

How to make a offer up kind of grid UI (please look the image 1), it has three same sized columns and height differs according to image size. i have implemented the view with the 3 linear layouts and a scroll view. but it's not very supportive when it comes to memory management. Can i make the view with grid view (since height is different)? or should i use any other method? or is it ok to use scrollview to load about 100 images at a time?

Android Force GridView items to fill full gridview height

First of all I'd like to say it isn't any duplicate. My problem is tha I have to much items and I want to make them smaller to fill in gridview height. That's why I cannot use setMinimumHeight. I need something like setMaximumHeight but nothing like this is predicted by Android SDK. Additionally I don't have any row spacing so I cannot make it smaller.
image to help understand:
I want make itemw smaller height, I don't want any to be "cut" by the display border.

How to merge elements of a GridView

i'm implementing a activity where the user can see images from different sizes and proportions on a GridView. I don't want to modify this images proportions.
Is it possible with GridViews or my best option is to build a TableLayout and just add each image to a TableRow?
Example: If it loads a 3x4 image, i want it to scale to satify some width and height constraint and them merge the necessary GridView's elements to keep the 3x4 proportion rate.
My objective is to reach something like this: https://www.dropbox.com/s/6jmt2x5ly1k2p92/grid.png
It seems you can as a custom gridview, I haven't tested my own, and too low to comment. So on this link you will find an image on the bottom using a gridview notice that the last item is larger that the rest and the middle left item is also off scaled.

How to set row height of GridView fit to Screen in Android

I want to stretch the row of a GridView to match the height of the screen in Android.
How do I do this?
You are in control over your row heights, by virtue of what you put in
them. Since your cells appear to have more than one widget, they are
presumably wrapped in a LinearLayout or something. Set your
LinearLayouts to be some specific height, and the rows will all be
that height.
Personally, I think you should be resizing your images if you are
going to have text above and below each image on a per-cell basis.
With the Reference commonsware link

Categories

Resources