Grid of Views with unequal size - android

I have an Android app with an image detail screen. Images have tags, and these need to be displayed at the bottom of the screen. When the horizontal space for tags is exhausted, they wrap to the next line up. Each tag should only occupy the minimum necessary horizontal space. Here is an image of the effect I need, from an iOS app:
How can I achieve this effect in Android?

You will need to implement such FlowLayout yourself or use some library. Have a look at this question.

Related

Android layout that crops rather than resize its children

I am looking for an android layout (if there exists) that can do the following.
2 images that occupies the entire width of the screen, stacked on top of each other. A slider say 2 or three pixels wide that allows a user to slide across the width of the screen revealing or hiding portions of the images.
Note that the layout like slidingPane does not work in this scenario as it resizes the contents in each pane rather than cropping them which is what I want.
To better describe the question here are some images.
Not really a layout, but achieves what I was after.
Added images to textureviews(1,2), added one of the textureviews(2) to a linearlayout. Added the texureView1 and linearlayout to a framelayout such that the linearlayout is on top. To achieve the above said effect the linearlayout and the textureView(2) that it holds is moved in opposite directions.

How to have images go to the next line if they dont fit

I am using Linear layout with horizontal orientation to put images beside each other. However, is there way that the images can automatically go to the next line incase they dont fit due to screen size?
I just dont want small screen (or small densities) to truncate my images
Thank you
Use RelativeLayout and reorder images via code according to image sizes and space.
OR
Extend GridLayout and make your own implementation of it.
This is not possible in LinearLayout as it is.

Increasing distance between objects in relative layout

I have a relative layout for my android app. It is a SurfaceView overlapped with a few images. I had to use relative layout for the camera over lay features. It is currently shown like in the image below:
The top red long rectangular bars are actually two short rectangle images. I would like to increase the distance between the two images so that they look like two individual rectangles. Is it possible to increase the distance in a relative layout?
If I position two red bars, one on top of the other, is it possible to increase the distance between the two?
Set a margin between the views and that's it ...
I was reading through the Android developer's page carefully. This page explains how to set margins on the layout

Android: scrollable image gallery layout

I would like to have a scrollable image gallery that takes up most of the screen. My images are small icons all of the same size. I can have a lot of images. Once the maximum number of images fills the screen horizontally, they should wrap to the next row. If there are more images than will fit in the vertical direction, then it should be possible to scroll vertically to view additional images. I am not sure what layout controls I should be using to accomplish this. An additional feature (be not a must have), is that the images are equally spaced horizontally with the same amount of margin. Any suggestions? Thank you.
Try a GridView.
Use GridView. Perfectly fits your needs.

overlay imageview without pushing layouts down

a picture is worth a thousand words, so my question should basically be self-explanatory with the attached image: How to get rightmost screen instead of the center screen?
turns out i cannot attach images directly yet, so i have to link to it right now:
How to get rightmost screen instead of the center screen?
just to add, i realise that it is not really possible to have the framelayout NOT expand as shown in screen 2b, but my question remains as to how to achieve such an overlay without pushing the Other layouts down i.e. the bottom part of the imageview would be on top of the top right part of the other layouts
perhaps you could have the image you are dynamically adding be outside the frame layout. ie have a relative layout contain both framelayouts and the imageview – jkhouw1 1 hour ago

Categories

Resources