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...)
Related
I need a component that works like the picture below but I'm having trouble coming up with some kind of decent solution that works.
I want the list to have a center locked selection but being scrollable with the d-pad. This is for an application running on a TV so no need for touch scroll. So when pressing down on the remote d-pad the list will scroll and a new item will size up and the current selected one will size down and the new selection will still be in the middle.
I've tried doing this using a ListView that I extended and programmatically scrolling when pressing down or up. On scroll finished I called notifyDatasetChanged() on the ListView for re-inflating of the childs and in the ListViews adapters getView() I made the animation of the view located at the current selected position.
This is not optimal since I need to call notifyDatasetChanged(), which re-inflates all visible views, for the animation to apply. The UI becomes laggy when doing this and scrolling fast. It's also not possible to make som kind of compress animation when current selected item goes out of selection. There is also some trouble with the end items (read views) such the first or last in the list when doing animation of them, the may sometimes go out of screen.
I think that his must have been done before and maybe I'm missing it when searching for an answer.
Have anyone done something similar or do you have some suggestions of how this can be achieved? Maybe I'm just starting of with the wrong component here..
Regards,
Kristoffer
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.
I have a button in each item of a ListView whose background is defined by an XML, one background when enabled and another when disabled. When the ListView loads, it comes out correct. But, for some reason I can't figure out, if I scroll down and then scroll back up, the wrong background shows up.
I'd like to know the solution to this problem, but besides that, in general what I want to accomplish is this:
I have a button in the ListView to take the user to the website for the given item. If there is no website, I want the button to disappear, or be disabled. I seem to have the same problem with both options.
Thanks in advance for your efforts
It seems most likely that the problem lies with your getView() method. Android recycles views to save memory, so, for example, when you scroll down, it calls getView(int, View, ViewGroup) on your adapter where View is the item that just left the top of the screen. If you're not re-populating the item with the new data from the adapter, (ie, just returning convertView) it will put the View that left the top of the screen where the "new" one should be.
I have searched a lot but I couldn't find an answer.
I want to implement something like in Go Launcher. When you drag an icon in app drawer and move it out of container top or bottom bound, the list begins to scroll.
So far, I have tried following things:
Dispatch touch events to simulate scrolling - impossible while touching the screen
Use smoothScrollBy() method - almost there, but it scrolls only screen height distance
Use scrollBy() - it moves only the container and leaves blank space. I would put there some rows if only I could be able to reuse views that went off the screen.
I need the ListView to scroll SMOOTHLY.
So here goes ma question. Anybody knows how can it be done? I'll put a gratitude in About section of my app to person who will help me:)
using listview and try scrollToPosition(),or smoothscrollBy()
I've been trawling the internet looking for an answer for several hours, but I can't seem to find anyone who has been able to solve this.
I've got a listview which uses a custom adapter. A row looks like this
The list is filled by an array. Everything works great.
Now, I want the ImageView and the ToggleButton to react to clicks, so I implement the OnClickListener in my adapter, put the items position in each view's tag, and then I set their onclicklistener to this.
Works great, except now I can't use the onListItemClick for starting an activity for the item! OK, I say, I just make the relativelayout holding the text in the middle there use the same onclicklistener. Works great. Everything is clickable, and life is good.
EXCEPT! Now, when I scroll the list, I cannot "continue" the scroll by just flinging again. This causes the scrolling to stop, and I have to fling once more to get it going again. It seems the onclick-thingy causes the fling-motion to be interpreted as a tap or something (it does not trigger the logic within onClick).
I know that this is possible by just going to the phone list on my HTC Hero, which has exactly the kind of layout and behaviour I want from my app. This app even seems to have the onItemClickListener working.
So how can I make sure the list keeps scrolling, and still be able to click the togglebutton, listitem and the imageview? I've been stuck on this all day, and it's giving me a headache :(
Another quick search before I go home, and I came across this:
How to fire onListItemClick in Listactivity with buttons in list?
CodeFusionMobile mentions setting the android:descendantFocusability property of the list layout to "blocksDescendants", and so I tried doing that. Everything works as expected now. Scrolling works, onListitemClicked works, clicking the ToggleButton works, clicking the ImageView works.
Just to make it clear... In the parent RelativeLayout, right at the top of the row.xml, I added
android:descendantFocusability="blocksDescendants"