I am developing an application that should show the calendar as an agenda in my own calendar. I have a list showing different events (Note: in the context of the question, this is an object of my system). I want to provide the Today button on this screen. When the user clicks on this button, the events should be scrolled until the first event of the current schedule is on top of the screen. The problem arises when I have only a few events planned from today - so few that they do not fill the entire screen. Then the list view simply scrolls until the last event in the calendar is at the bottom. This usually means that the desired effect from today's first event at the top is not achieved.
Any suggestions how to do this? I thought about adding some elements to the end, but this seems like an ugly workaround, and in addition, it will require special calculations for a particular device, which will tell me how many elements need to be inserted.
Edit :
Adding some code as requested in the comment
Actually, I'm not sure if this code will surprise anyone, but:
public void onTodayClicked(View target) {
I'm not sure that defining a layout is important to answer a question, but if you think so, I can add it too.
source share