Skip to content

first time initialize the calendar, selected circle will expand to parent width and height #1128

Open

Description

@jerrylkc

when setTileWidth or setTileHeight, and setSelectedDate
the first time we initialize the calendar, the selected circle expands to view width and height, like oval shape,
but after a while, it returns to a normal circle.

I have tried using DayViewDecorator, and set setSelectionDrawable for custom drawable with fixed size,
but no luck.

Activity

  1. Mor1995 commented on Apr 27, 2022

    @Mor1995

    I facing the same problem, I found that cause of the problem is onDraw() method called before onLayout(). The rect is unset in onDraw() method, So the cicle will filling rect and you see it like oval shape.After a while it back to normal circle because it relayout and set correct width and height.

    In my code, I delete invalidateDecorators() called in onDateSelected().

        widget.setOnDateChangedListener(new OnDateSelectedListener() {
          @Override
          public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) {
        //    widget.invalidateDecorators();
          }
        });
    

    It's work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions