ExpandableHeightGridView alternative (Image + text gallery) - android

the last following days I was fighting with the mentioned GridView hack. Problem was and still is that it cuts the last row. I couldn't fix it therefore I need a new alternative.
What I want to build is scrollable 3(columns)x2-8(rows) layout with image and some textview. I put it in a ScrollView.
Maybe you could suggest some alternatives for a GridView to do that?

Well, I have actually found a solution. I have implemented GridView (assigning GridLayoutManager) in the RecycleView. Now it works as it should and no more custom GridLayout implementation!
Inspiration from here
http://blog.iamsuleiman.com/image-gallery-app-android-studio-1-4-glide/

Related

Dynamic Android Grid Layout with custom positioning and sizing of children

I'm currently trying to create an Android grid layout from custom elements(taken from a db) and am in need of suggestions on how to implement it. The grid should have 6 columns and it should be scroll vertically. Each Grid Element(Item) has columnSpan, columnRow, xPosition and yPosition.
Here is an example of the desired result:
I tried with a GridLayout, but there is no adapter support with it.
I tried with Grid View, but can't manage to make it look right.
I need a robust solution, but at this point I'm desperate just for a working solution.
Here is an old post with hacky over-complicated solutions. Has something changed? Is there a good solution to this problem? And why does this problem exist in the first place?

Scroll text inside recyclerview element

I have a recyerview which contains in each row a picture, a title and a description.See here.
The height of an element of the recyclerview is fixed.
The problem is the description could be too long for the fixed height.
To solve it I would like to implement a vertical scrolling that could allow me to read everything in any cases.
I have no idea where I have to search to do that.
Someone has a good tutorial to follow ?
Thank you.
As far as I know, you will get scroll conflicts by doing this as the recyclerview will not know whether to scroll itself upwards or to scroll the actual text inside it's views.
A better approach is to implement an expandable textview, an easy to use library can be found here:
https://github.com/Manabu-GT/ExpandableTextView

Horizontal scroll with gridview

Now i have to create a horizontal listview again, this time i want to find a better library for this, as far as i know android did not have a horizontal listview, and then i read this
http://developer.android.com/design/building-blocks/grid-lists.html
They mention if gridview can scroll horizontally, they even illustrated it with a picture. I try to find example of how to use gridview horizontally, but i have no luck,
is anyone here can help me how to use gridview scroll horizontally?
This is the best library for two way grid. I have used it and it works perfectly.
https://github.com/jess-anders/two-way-gridview
I'm end up using recyclerview as #tyczj recommend

Autosizing GridView

Is there any lib that can help me to achieve what CollagePlus jQuery library does?
I have a list of pictures (link and dimensions). Dimensions could be different and i need to arrange all images inside one view like in attached screen.
Update. I have a listView (RecyclerView), each item could have such gridView - so layout_height has to be wrap_content.
I've tried StaggeredGrid - that's not exactly what i want.
Also tried AsymmetricGridView - very buggy.
the support library there's the new RecyclerView that can achieve exactly that, you just have to use the GridLayoutManager and supply a SpanSizeLookup
here are the links for the docs
https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html
https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager.html
https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager.SpanSizeLookup.html
This should help you achieve what you want. It's etsy's staggered grid view. Well supported.
https://github.com/etsy/AndroidStaggeredGrid

Android ScrollView layout problem

I have several ListViews in a LinearLayout. It's listing things by day, so I have a TextView containing "Sunday:" followed by a list of items, followed by a "Monday" TextView, etc. Works great, but doesn't fit in the screen. So I added a ScrollView as a parent of the LinearLayout. Now it scrolls, but the ListViews all have room for 2 entries, whether they have 0 or 3 entries. Something about adding the ScrollView parent caused the ListViews to not size dynamically. I tried calling requestLayout() on the ScrollView after the list adapters had filled their views, but that didn't do anything. Any ideas?
Edit:
From http://www.anddev.org/viewtopic.php?p=25194 and other links it seems that ListViews inside a ScrollView are not handled correctly. Anyone have a good suggestion for implementing a list-of-lists?
I'm interested in that topic too, so I did a bit of research. First: Never put a ListView in a ScrollView (as you found out yourself). Unfortunately googling this problem doesn't lead to any solutions, so I tried my suggestion from my comment above.
I implemented a custom ListAdapter and put the ListViews into one parent ListView. This doesn't work (leads to the same problem as with a ScrollView). Speaking to the guys on the official android-irc #android-dev on freenode, they told me that putting ListViews into a ListView is as bad as or even worse than putting them into a ScrollView. Unfortunately they also couldn't help me with the problem.
There seems to be only one way to achieve what you want to do; see the answer on this similar question Scrolling with Multiple ListViews for Android . The idea is to merge all ListViews into a single one by a custom adapter and to insert some kind of headers between entries. This is absolutely doable but might require some special effort.
I know it's late to answer this right now, but still - it may be useful to others who arrive here in case of similar problems.
I'd suggest that you use an Expandable ListView for this. It would solve all of your problems.
You can have the main/parent names as that of week, and when you expand it, you would have the list of entries for that particular day/week/whatever.
Also, you wouldn't have to worry about scrolling as it is taken care by android :)
If you DO try this, then please let me know if this works out for your problem
Try searching for examples on Expandable ListView.
edit:check example here - http://mylifewithandroid.blogspot.com/2008/05/expandable-lists.html

Categories

Resources