ListView with a (half- and or) hidable header - android

My Problem, is that I don't even know what to search for.
I want a ListView.
This ListView has some Elements with a "sticky" state.
If I scroll down the List on the device, I want that all ListElements with state "sticky", to be sticky ontop of the list (non-scrollable) till there is another one "pushing it away". The rest of the elements are supposed to scroll as normal.
I've seen that kind of List in the Google Market. If you have a big screen you can see that list on the Detailview of any app on the left side or if you have android JB, the same effect is on the google search bar in the google now app.
Image One: You can see the normal ListView on the left side
Image 1 http://www.android-hilfe.de/attachments/android-app-entwicklung/120884d1347256368-suche-stichwort-fuer-suche-nach-spezieller-listview-liste1.png
Image Two: You can see the normal ListView scrolled up a bit
Image 2 http://www.android-hilfe.de/attachments/android-app-entwicklung/120885d1347256368-suche-stichwort-fuer-suche-nach-spezieller-listview-liste2.png:
Image Three: You can see, what I actually want. The View is scrolled up but the "sticky" price does not disappear. Instead of that all other elements, went under the "sticky" one
Image 3 http://www.android-hilfe.de/attachments/android-app-entwicklung/120886d1347256368-suche-stichwort-fuer-suche-nach-spezieller-listview-liste3.png:
How do I do that?

I think that you meant to do some "synchronized scrolling".
There's a great post explaining how they've done in on Google Play:
http://www.pushing-pixels.org/2011/07/18/android-tips-and-tricks-synchronized-scrolling.html
Hope that's what you were looking for..

I believe that is a separate component, not related to ListView in any way.
Just create the header, let it be a RelativeLayout, or LinearLayout, and fill the rest of the area with the ListView set to fill_parent. Then, when you'll scroll the ListView, the "header" will stay sticky (as it is a separate component), and the list will scroll down.

Related

How to implement custom listview with "stacking" feature Android

I want to create a custom listview that scroll horizontally and stacks the last 4 items in the view instead of allowing them to go off screen. The stack should look something like this: . So if a user scrolls all the way to the left they see a regular listview, but as they scroll right, if an item was supposed to go off screen, it is instead stacked behind the last item in the list, with a max of 4 stacks. What's a good basic way to accomplish this? I already found the horizontally scrolling listview library I wanted to use but don't know where to start on the stacking part.

Scrolling of list below another view

I have seen an app which has different type of scrolling. I hope images attached will be able to explain it. Here the list when scrolled up, moves up by taking DownloadAll, Playall button up too. Later on DownloadAll and PlayAll button stops going up and only the list scrolls up.
I don't know what this is called as. I tried searching, but could not find anything similar.
How can I achieve this type of scrolling?
Take a look at "Libraries for developers" it has a section of listview where you can find different styles of listviews (plus scrolling animations such as sticky, animated scrollview, flabby etc...)

How to create a gridview with spacing at the top

I was looking to create a GridView that stretches across the entire screen. However, when the user first opens the screen, the top of the first item should be about halfway up the screen.
For example lets say we have a GridView of 12 items displayed 3 x 4. When the user first opens the screen, only the first six items would be seen with a large margin at the top of the screen. The user can then scroll the list to see the other items. The top items would eventually reach all the way to the top of the screen.
If I was using a ListView, this is simple. I merely create a 0dp headerView with a large top margin. But, GridViews do not allow for headers. What is the best way to handle this situation?
Normally, you DO NOT make a GridView inside a ScrollView. It's not recommended! But sometimes you have no choice and you need to addHeaderView() on a GridView (But I repeat, it isnt recommended).
So, to make this happen, you have to make a custom GridView. This answer will be usefull in your case: Grid of images inside ScrollView
I had a same situation and I used this one: HFGridView by #SergeyBurish! Very simple and really great. (See the last answer here: A GridView with header and footer).
Hope this will be helpful.

Android: Add image on top of each item in a listview

Does anyone know if it is possible to layer an image over the top of each item in a listview? To indicate that each list item is clickable, I'd like to add a small right-pointing arrow on the extreme right side of every item in the list. I'd like this image to scroll with the list.
I know that I can just create a horizontal linearlayout and put the image there, but this takes up some of the screen. I'd rather have it "floating" over the top of each item. Hopefully I'm making myself clear.
Thanks!
Short answer: don't do this, it directly contradicts Android UX guidelines, http://developer.android.com/design/patterns/pure-android.html
Long answer: post your xml/code for building the cell. It's probably enough to use a RelativeLayout and align an ImageView to its right side.
Again, this is completely unnecessary and an anti-pattern on Android. Don't do it.

how to Expand and collapse listview on click of button?

I have a listview in my fragment which occupies around 25% of my screen size. I also have a stripdown button. So, I want that when a strip down is clicked, that that time list view should expand and cover around 50% of the screen size and then again when i click stripUp it should return to it's former state. Can you please suggest some techniques through which i can achieve this.
My listview is like this: say i have 25 elements then initially only 10 of them are visible and to see others i will scroll down in Listview. After that when i click on stripDown button then number of visible items will increase to 15 and to see other elements i will scroll down.
Thanks in advance.
Try the ListView section on the Api demo prior to honey comb. There are several examples that depict the usage of ListViews. It also includes an ExpandableListView and a regular ListView with an expandable effect.
You can find the demos from you Android SDK installation on your machine.
android-sdk/samples/android-x/ApiDemos

Categories

Resources