I have a HorizontalScrollView that shows three dates at once and snaps to the date in the middle when you lift your finger. Currently the dates are saved in an LinkedList.
The list has to be dynamic, means that when I scroll to the right, it has to reload the next dates on the right and delete some of the dates on the left. The problem is, I don't know how to create a link between my LinkedList and the ScrollView.
Here is a link to how it looks
Its my first post, so please excuse me if I'm not specific enough.
EDIT: Okay, I found the answer: Gallery offers exactly what I want.
As I said in the OP: Gallery in combination with a custom Adapter solved my Problem.
Related
So I did some research and testing of using a listview in a scrollview, and as a lot of people may know this is supposedly bad to do, since they both scroll. It also means I can't show the complete listview as it will wrap to be smaller.
I have seen places which re change the height of the listview to fix this problem but again most people say that it isn't preferred.
What I would like to know though is what is the preferred way of making a nonscrollable listview like view? Basically I want the exact same as the listview but obviously non scrolled and the height based on its contents. I would prefer to work with the layout in as much XML as possible, and I would like to be able to send my array list to it to view on screen. Unfortunately either my search skills are quite dull, as I haven't been able to find anywhere that really explains the preferred method so I thought I would ask here.
Thanks for your help.
<>Clarification Information
I thought I would put this here in case it will help, first off I basically want to show an image, with a list of comments (each one has an author and a text) below it, the comments themselves are obtained from an array and can change. I want the whole page to be scrollable though so I can either view more comments or go back up to the image.
Using a RecyclerView and an adapter supporting multiple item types you could make a list which shows an image on top and several comments below it. Generally you'd have to check what item corresponds to each position - in your case on position 0 you have an image and in every other position you'd have a comment. Then in your adapter's onCreateViewHolder and onBindViewHolder you would check the item type and handle them differently.
You could take a look at this answer for a short example.
Let me know if you'd need any other details and/ or sample codes to get the idea. :)
How do I do pagination using ListView. For an example, I have 12 records in my ListView and I want to show first 10 data in 1st page and the remain data in next page.
You can add a footer on your listview that will hold the buttons for next and back. In an stackoverflow question you have the complete solution for that.
Next step can be done in several ways. The simplest one, that I am seeing right now, is: Save the page you are at a variable. Then, each time you do next you add one to that variable. In your adapter, in the getView you multiply that variable by the position so you can get the correspondent position depending on the page the user is.
Better way to build view like pages, use Fragment,You can show desire content in pages as you mention in your question, for more details look out section 21 example,it cover fragment.
I want to create a horizontal listview which contain many item, one item will contain a image. When user slide listview => the count of item will be fix when it display, example display only 3 or 4 image. How can I do that? Many thanks.
Edit:
I use this
to create a HorizontalList view, everything is ok but I don;t know how to make the Next and Previous button work! Any idea?
Instead of a horizontal ListView (which, as far as I know, isn't offered by the Android SDK) you can use a HorizontalScrollView. You can add the items like to any other kind of layout class.
It looks like what you are looking for is a Paginated Gallery. I have written one here.
Its still only a couple of days old but hopefully the included Activity code will get you off the ground.
I have a Custom ListView containing events. The Adapters SectionIndexer indexes the day of the week and time of the events upon fastscrolling (e.g. Monday 10:00) but with the default styling of the fastscrolling text, the text is to big and gets cut at the edges.
Is there any way to change the layout of the SextionIndexer dialog? I specifically want to remove the box in the background (or enlarge it to match the day and time displayed) and change the textSize.
There must be a way :) I can't be the only one wanting to index something else than the first letters!
Maybe you already got your answer but anyway for you and others I found a post about this problem
Take a look at this post Fast Scroll display problem with ListAdapter and SectionIndexer
Hope it helps!
This is my first post on stackoverflow. I use this one some times when I have a problem and find a solution every time. But today is different. Have a non-solved problem :
I have on listview and I want apply a magnetic effect on this. To make this, I use scrollBy one by one pixel with Thread to move listview position. Visually, it's perfect, listview move good. But when user want scroll again, listview come back to his previous position (just before scrollBy) before scroll normally with user finger.
I've tried some tests, for exemple I display v.getTop() (v is on view item in listview) value BEFORE my scrollBy and AFTER. Values are same, but visually are really different because list are moved. Also visually, you can see a little artefact : this divider is ON listview item. It's means that visually, listview is good, but programatically isn't good... while scrollBy make invalidate estate.
Anyone have an idea or a solution ?
Thnak you for your help.
PS : Sorry for my english, i'm french. Thank you again.
Use getScrollY() to find the current position and then set that position after it gets reset.