Is there a horizontal scroll widget inside listview - android

I need to make a scrollable row in ListView's item. The row should behave similar to Gallery or ViewPager. It was designed to behave similarly to Facebook gallery.
I was planning to use Gallery but since it has been deprecated I'm not sure if it's a good choice. Although Fragment is recommend to be used to replace Gallery, it's not expected to be put inside a ListView.
Is there other options for available? Or should I implement my own custom view to calculate and handle the view transition? Has anyone try something similar?

Make the row item a HorizontalScrollView with a LinearLayout inside.
Make the LinearLayout's oriantation horizontal and add the things you need inside.

Related

What is the best way to implement contents and comments in One scroll view

I want to implement the below image in android ,
I have used Relative Layout to display content and Recycler view to display comments but I want both under one scroll while my problem is recycler view is creating another scroll.
I also thought to add a layout dynamically but in that every layout I have to implement click listener for every child , which is not good for performance
What could be the best way to implement it
You can make a ListView where row contains Comments part and add Image as a Header of that ListView.
The other way is to create a Custom Adapter and include Image and Comments as a single row of a ListView
For implementing a click event on each item you can refer to this answer
Why don't you use a ListView with custom elements in it (that look like the comments on the picture) instead of the RecyclerView

Which View/Widget can be used to display images on the screen one at a time by swiping horizontally?

I have a list view in which I want each list item will contain images. But the images will be displayed one at a time. SO, at a time for every list item only one image will be displayed. To view other images in the list item,one has to swipe horizontally. Is there any inbuilt widget that handles this in android?
EDIT1
My List item not only has Image but it also contains other views like textview, seekbar etc. So each list item will contain Image, textview, seekbar etc but the majority of the space will be occupied by the Image. Now, for each list item, when the image is swiped horizontally, another image has to be downloaded from a ulr and displayed.
EDIT2
I did a bit of research on ViewPager but many references like the answers here and this blog seem to suggest that using ViewPager inside a listview is not a good idea. Why is that? If it is not a good idea, what is a good alternative?
This problem can be solved by using ViewPager.
Link: http://developer.android.com/training/animation/screen-slide.html
ViewPager(for swiping between views) + UniversalImageLoader(for loading images from URLs, with caching etc)
If it is not, what is a good alternative?
I think you should use RecyclerView with LinearLayoutManager.HORIZONTAL. All things like recycling the views, view holder design pattern can be done easily with it and it is a new widget that google introduced and you can use it instead of ListView + ViewPager. because as you suggested it is not recommended to use viewpager inside listview. Although you can use horizontalScrollView but it dose not recycle the view. Other third party library like this exist but I recommend you use RecyclerView with LinearLayoutManager.HORIZONTAL because it is from google and it is normally tested more than people library. And another thing is you can use other layout manager like GridLayoutManager or having for example 3 rows that swiping horizontally or other good effects like adding animation and .... that google provided with RecyclerView.
For downloading the images you can use Picasso,Volley, Universal Image Loader or a lot of other libraries that exist.
Happy Coding :-)
Not sure I'm following you, but rather than a ListView wouldn't it be simpler to use ViewPager with simple Fragment that wraps a single image at a time. That way you get horizontal swiping "for free".
Do you just want swipe to change images? Or do you want the images to scroll as you swipe? For the former, you can just use a GestureDetector. For the latter you would probably use a ViewPager. See http://developer.android.com/training/animation/screen-slide.html
I have achieved the same functionality by using ViewPager, you can either put the SeekBar and TextView in the Fragment class off which you are gonna make multiple instances for each item and add to the pageradapter,
You can also add the TextView and SeekBar above the ViewPager Layout in your main fragment layout file and change the text and data on seekbar on viewpager's on item change listener, this looks more neat and this is the approach i've used

Correct Android layout for this design

I am trying to build the following layout, but am unsure which android layout I should be using.
Its just a table (correct terminology?), but I would like functionality such as swipe to delete a row, and to expand on click (to reveal another view). It should also be scrollable.
What I have currently is a LinearLayout on a scroll view, which I populate with other custom layouts.
To achieve the expanding functionality, I have more custom views in the LinearLayout which are hidden by default, and then revealed if they layout above them is pressed. All of this lives in a ScrollView.
Would a TableLayout be better for all of this? I originally picked LinearLayout instead of TableLayout because I was confused about the TableLayout columns (and didn't need multiple columns). I feel like right now I am reinventing the wheel.
You don't need ScrollView or TableLayout at all. The easy way is to use a ListView, then on the raw adapter, you implement an onTouchListener method with swipe gesture algorithme (not hard to code).
But the swipe and expandable view can be handle with this library (very usefull)
https://github.com/nhaarman/ListViewAnimations

Multi column listview layout

How to do a layout like this? I currently use a listActivity and I need the same experience with this kind of layout.
You can use Staggered Grid View library. Also check and Quilt View. This is what you need.
To get this effect, you should create two list views and link the scrolls of both lists.
Define a OnScrollListener on both listviews and when "onScroll()", move programatically the other list. I think if all images are cached you shouldn't have delays.
You can use Staggered Grid View library. But there you need to mention height of each image pragmatically to set height of list view. Else when you scroll to end and come back to top, the alignment of images on top will get disturbed
You have to use GridView
You can refer this or this.

Horizontol Scrolling View in Android

I want to create a Horizontol Scrolling View in Android. The view would be a combination of images and text scrolling horizontally and I should be able to dynamically modify the content(text and images) in the Scroller
Any ideas?
add HorizontalScroolView in the scrollview it will scroll in both directions.
ScrollView
HorizontalScrollView
ImageView
You could perhaps also have a look at the Gallery element.
You'd like something like ListView, but in horizontal orientation.
I'd make this to extend AbsListView, which is made to display dynamic lists.
Ideally if you'd copy ListView source and switch it to horizontal mode, but this is very complicated and long class, so look for easier options.
Try using GridView with just one row, stored in a HorizontalScrollView. Feed it with a ListAdapter, provide Views for your cells and setup content to display.
I didn't try this, but it seems like easy solution. Assuming that number of items will not be large, because there won't be optimizations available in ListView class.

Categories

Resources