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,
Related
How can i implement the following UI design in Android?
The data is retrieved from API so each event is an item and also the Big red card is also an item. The problem here is the background, it should scroll with the items and the items should be positioned on the yellow line. I thought of ItemDecoration for item offset and a simple path to draw, but i never used ItemDecoration, and from this UI it seems that the background would be an Image.
Is there any way to implement this?
There is an application called , which has a similar design, but in horizontal scrolling. It has a long horizontal scroll with background image which seems like fragmented images stuck together when scrolling.
So please can any one help me get an idea of how this can be achieved?
I'm experimenting to see if the layout scheme I want to use is possible. I want to have an XML layout that's scrollable. Within that scrollable layout, I want to have a single line going horizontally across the screen (I used just a View with a fixed height and different color). When that horizontal line reaches the top of the screen, and as I scroll down through the layout, I want it to stop and remain at the top of the screen while being able to scroll through everything below it.
I've been messing around in XML trying to get it to work, basically putting a bunch of junk before it and after it.
Any ideas as to how that might work? Would I have to do something fancy with the java code to fix the red line at the top when the scroll position reaches a certain point? Your help would be greatly appreciated.
I am assuming you want something like Gmail app where when you scroll a mail the header sticks on top... To do this, you need 2 views. You have your regular scroller below and overlay a fixed view on top (you can use a relative layout to do this). When your cell goes past a certain spot, you want to populate and set the visibility of the fixed view to VISIBLE. This would give the impression that the view you want to 'stick' to the top really just got stuck rather than scrolled out of view. You'll have to work out the opposite scrolling scenario too based on the location and height of the scrolled cell/view.
HTH
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 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.
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.