misosvec / SingleRowCalendar

Android library for horizontal single row calendar. With this library, you aren't attached to library built-in UI. You can create really beautiful and customizable UI and use selection features without hands getting dirty with RecyclerView and SelectionTracker.
Apache License 2.0
370 stars 53 forks source link

Current date selection by default #19

Open muneebahmed97 opened 3 years ago

muneebahmed97 commented 3 years ago

I have implemented your library in my project. can anybody please tell me how can I mark current date selected? TIA :)

andreyneto commented 3 years ago

Just call select() right below init(), passing as parameter the same value you had setted in the pastDaysCount field.

abbasabidi85 commented 1 year ago

andreyneto

it's showing by deafult "1st of the month" not the current day and date

kelalaka153 commented 8 months ago

Assuming that you have the index/position of today

singleRowCalendar?.select(14)
singleRowCalendar?.scrollToPosition(12)

Here, 14 is the index of today - 14 pre | today | 14 post - in my application

why 2 less in scrollToPosition, well, there are 5 on my design that can show, and scrollToPosition brings it to the beginning. You can adjust according to your needs and don't ask to scroll out of ranges.