Merging ViewFlipper with ListView - android

What I'm trying to do is to have horizontal ViewFlipper and Listview, both with custom ArrayAdapters, inside LinearLayout which would be vertically scrollable on whole screen.
1) Tried adding ViewFlipper as a ListView header but then I can't use GestureListener since ArrayAdapter takes control over it like it's ListView item.
2) Tried putting them together inside LinearLayout but ViewFlipper's position is fixed and ListView is scrollable inside rest of the screen.
3) Trying with MergeAdapter but it can't handle swipe gesture on it's first element (ViewFlipper), it always returns ViewFlipper's item position.
Here's the picture to clarify what I'm trying to make. Top Stories is ViewFlipper and Latest Posts is ListView. And they both scroll vertically. Ignore bottom tabs and ActionBar as they are static (nonscrollable).

You've got your work cut out for you.
Here are two approaches:
1) Set the view flipper as the first row in the List view. Its a special case. Not as a header, but as a regular row.
2) Use a scroll view, and do not use the list view at all. You may have performance problems if your data for the list view is a large number of items.

Take a look at the ViewPager from the Android Compatibility Library it does what you need

Related

addHeaderView or addFooterView not available in Recycler VIew

I was trying to design my screen as of same in Swiggy App. First, it has horizontal recycler or horizontal scroll view.
Second, it has tab bar which will stick on the top once we will scroll up. Third, it has a vertical recycler view or maybe listView showing restaurants.
So, if we have vertical listView, it's very easy to stick that tab bar(view, the second thing on screen) on the top.
You can see an example here: https://dzone.com/articles/creating-a-listview-parallax-effect-with-a-sticky
But in case of RecyclerView, it doesn't have any direct method addHeaderView. So how do we implement this with RecyclerView.
Use getItemViewType method and create three view holders for first, middle and last items.
RecyclerView with multiple view type

Disabling the scroll of listview

I have created a listview inside scrollview. Atfirst it was not scrolling but when it started scrolling then layouts below list view started disappearing from screen. is there any solution to dynamically calculated he height of list view and assign it or is it possible that some how the scrolling of listvew is disabled so that only its items appear on screen like normal layouts or any tags and it does not scrolls???
ListView is deprecated. I would suggest you to use RecyclerView and add nestedScrollingEnabled="true" to your xml or call RecyclerView.setNestedScrollEnabled(true) if you want to wrap adapterview with a scroller. You can also try NestedScrollView for support compability.
Good luck

Is there a horizontal scroll widget inside listview

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.

Android - Create a Vertical ListView with Horizontal scrollable row

I need a Vertical ListView where each row is a horizontal scrollable list of items.
Each items is an image with a button.
I need the app to be compatible with Android 2.2.
I've read 3 working solutions here
Use a custom Horizontal ListView as rows
Use a ViewPager as rows
ViewPager inside ListView
Use an horizontal ScrollView
These solutions are a bit old and each has their detractors.
So I was wondering, at the current state, is there an "official" solution for my problem?
Or, what is the best one?
If the no of items in the vertical ListView are fixed then you are better off using Horizontal ListViews for each.

Android List View

In my Layout there are some widgets are there in above to the list view. When i scroll through the list view i want to scroll my layout fully.Please any one can suggest the answer
Put the widgets that are presently above the ListView inside the ListView, either by using addHeaderView(), my MergeAdapter, or your own custom Adapter class. The, those widgets will scroll along with everything else in the ListView.

Categories

Resources