-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarification: Can I able to show the events of a particular day using this calendar #1075
Comments
You can mark the days with events with a specific decorator. See the documentation about daydecorators. |
@XanderZehcnas Can you let me know shall I able to show the dates and header of the calendar in a different color and custom style for this calendar view |
You can highlight a day with a color dot (This is what I have implemented) or you can create your own decorator (or so it seems) class CalendarEventDecorator(private val color: Int, private val dates: Collection<CalendarDay?>?): DayViewDecorator {
} This decorator can then be applied to a set of dates. In my case I observe a list of CalendarDay (The class used within this library) to incorporate the decorators: viewModel.reservedDates.observe(viewLifecycleOwner, Observer {reservedDates-> |
@XanderZehcnas Thanks for your detailed explanation. Can I able to set background for this https://i.stack.imgur.com/Z16zO.png. Now I have the header and calendar in a same color. But I need to show the calendar background header as blue and calendar dates background as white |
I don't see a specific attributes for that. I have a round white background
for the whole calendar.
You may do it by having a layout behind the calendar with two views one for
the top background and another for the rest and distribute their heights
accordingly. But it is not very elegant this way.
El mar., 17 nov. 2020 a las 13:02, nihp (<[email protected]>)
escribió:
… @XanderZehcnas <https://github.com/XanderZehcnas> Thanks for your
detailed explanation.
Can I able to set background for this https://i.stack.imgur.com/Z16zO.png
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1075 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHHPLIM5PPZUCCL3R7H3Z6TSQJQ4BANCNFSM4TK7P2XQ>
.
|
@XanderZehcnas Thanks for reply. My Calendar is inside a LinearLayout. How can I add two view for this?
|
Put it on a Constraint Layout and add the views there also before the
calendar:
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintCalendar"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@drawable/round_back_shape"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0">
<View
android:id="@+id/view1"
android:background="@drawable/top_background"
... />
<View
android:id="@+id/view2"
android:background="@drawable/bottom_background"
... />
<com.prolificinteractive.materialcalendarview.MaterialCalendarView
android:id="@+id/calendarView"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
... />
</androidx.constraintlayout.widget.ConstraintLayout>
You will need to connect both views. But I don't know how will it fit the calendar heights for the days and titles. You may need to test it on different screeens for sure.
El mar., 17 nov. 2020 13:45, nihp <[email protected]> escribió:
… @XanderZehcnas <https://github.com/XanderZehcnas> Thanks for reply.
My Calendar is inside a LinearLayout. How can I add two view for this?
<com.prolificinteractive.materialcalendarview.MaterialCalendarView
android:id="@+id/calendar_view"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_marginTop="50dp"
android:layout_gravity="center"
app:mcv_selectionColor="#00ADEC"
***@***.***/calendar_background"
app:mcv_showOtherDates="defaults"/>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1075 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHHPLILXSJ7XUAHB4VU5FXTSQJV5DANCNFSM4TK7P2XQ>
.
|
Okay thanks I will add the above inside the Constraint Layout. Will check. |
It shows an empty screen. Why the layout_height is 0dp? Can you please elaborate it? If I make the layout_height to any value it will show the calendar with the background which I set for the entire one @drawable/round_back_shape. |
@nihp Just put the calendar inside a MaterialCardView and set the cornerRadius of the cardview to something like 15dp |
Need to show the calendar events. Can I able to show the events using material calendarview
The text was updated successfully, but these errors were encountered: