I would like to change the default behaviour of my listview, so when im scrolling to the last item, the list will keep scrolling untill the last item is at the top of the list.
default behaviour stops scrolling when the last item is fully in view.
Any ideas on how i can go about this pre 2.3?
Thanks,
Totem.
In case anyone is interested in the solutions available it either:
1) add to the list view padding, that solution forces you to play around with the fading edge property since it gets sifted because of thee padding. also this method might not work well if your using a transparent background because items will be rendered and visible under the padding area. Although this could be fixed by entering the list into a relative layout and making sure to draw something over that area.
2) add transparent items to the listview for offset and not set them as enabled to avoid dividers, just need to make sure to change getItemCount and getItemTypeCount and so on if your if your item isn't really inside your adapter as per my case.
I went with option two.
Thanks,
Totem.
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
i am using an expandablelistview to show a list of groups containing different counts of children. sometimes the list is very long, so i wanted to enable fastscroll. i did this and everything is working fine when i scroll the list with the finger in the usual way.
but when i grab the thumb and drag it to the bottom, the list is scrolled to the last position when i have moved the thumb about 1/3 of the height from the top. what can i do to have the thumb position the list according to the full height of the scrollbar?
Last answer went missing.
This is a known bug in Android FastScroller.
See my code attached to http://code.google.com/p/android/issues/detail?id=24635
it contains a work-around that works for some specific cases.
I posted a workaround here. It uses a OnScrollListener to act differently if the user scrolls via touch or via thumb.
I have a home screen widget that tries to mimic a list of items, basically it's just 4 views in a vertical linear layout and there's 2 arrow buttons to "scroll" through list.
I'm able to scroll just fine querying the provider using limit offset, count.
The problem is that i'm using a transparent background and when i switch to the next set of results, the text of the item draws over the previous ones. It's like that view doesn't get invalidated.
Has anyone experience something like this? I tried using an opaque background and of course it works but i wanted a transparent one. I tried searching, but haven't found nothing like this.
Thanks,
In listview when it is scrolled, the top item which is going out of scene is attached at bottom which is coming in to scene.
Is this behaviour fixed or we can disable this feature.
In my listview, i got only 10 items so this feature is not that important to have.
If you ignore the "convertView" parameter on your Adapter.getView(), the old view will not be used, but it will be regenerated when you scroll back.
If you don't want this behavior, use a LinearLayout.
How to do the following stuffs in ListView
Only show scroll bar when user flip the list.
By default, if the list is more than the screen, there is always a scrollbar on the right side.
Is there a way to set this scrollbar only shows when user flip the list?
Keep showing the list background image when scrolling.
I've set an image as the background of the ListView, but when I scroll the list, the background image will disappear and only shows a black list view background.
Is there any way to keep showing the list background image when scrolling?
Don't show the shadow indicator.
When the list has more items to display, there is a black-blur shadow to indicate user
that there are more items. Is there a way to remove this item?
The issue with the black background is easy to fix. It's an issue with the cacheColorHint - a way to tell Android what the background color of your list is so that it can more easily create the "fading edge" at the top and bottom of your list when the user is scrolling. However, if your background isn't a solid color then the cacheColorHint does more harm than good. See this post from the Android developer's blog for more information. The way to fix it is just to add this to your ListView xml:
android:cacheColorHint="#00000000"
You can change that color code to whatever you want; it's in AARRGGBB format, also sometimes known as HTML color codes but with an extra 2 digits in front for transparency.
As for removing the scrollbar unless the user is actually scrolling, I'm not sure. Experiment with the various android:scrollbar... settings. If you're using Eclipse, you can type out android:scrollbar and then hit ctrl + spacebar to make it suggest options.
You can just turn scrollbars on and off using setVerticalScrollbarEnabled(). The "shadow" indicator is called the fading edge in our APIs. There are various methods to control the fading edges in the base View class.