question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Calendar not display in case of Fragment

See original GitHub issue

Problem : When fragment loaded then calendar view not loaded its like blank mention in the screenshot.

Screenshot img_20181030_175150

layout.xml

<com.applandeo.materialcalendarview.CalendarView android:id=“@+id/calendarView” android:layout_width=“match_parent” android:layout_height=“0dp” android:layout_weight=“1” app:eventsEnabled=“true” app:type=“one_day_picker” />

Fragment code

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    fragmentRosterBinding = DataBindingUtil.inflate(LayoutInflater.from(container.getContext()), R.layout.fragment_roster, container, false);
    //fragmentAddSalesBinding.
    min = Calendar.getInstance();
    min.add(Calendar.MONTH, -2);

    max = Calendar.getInstance();
    max.add(Calendar.MONTH, 2);
    fragmentRosterBinding.calendarView.setMinimumDate(min);
    fragmentRosterBinding.calendarView.setMaximumDate(max);

    return fragmentRosterBinding.getRoot();

}

Note : If we click on Next/Previous month in this case its loaded the calendar. Then work properly.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:13

github_iconTop GitHub Comments

1reaction
tnqvcommented, Nov 17, 2019
<android.support.constraint.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <com.applandeo.materialcalendarview.CalendarView
                android:id="@+id/calendarAppView"
                app:type="one_day_picker"
                app:eventsEnabled="true"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
        </android.support.constraint.ConstraintLayout>

I tried to put the CalendarView inside ConstraintLayout and it works perfectly…

1reaction
jakanocommented, Nov 29, 2018

Moving my Framelayout from a Linear Layout to a constraint layout fixed the issue for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DatePicker in Fragment Android didn't show - Stack Overflow
I am trying this code for activity and then is success, but I try in Fragment datepicker didn't show. My fragment is in...
Read more >
Developers - Calendar not display in case of Fragment -
Calendar not display in case of Fragment ... Problem : When fragment loaded then calendar view not loaded its like blank mention in...
Read more >
Using DialogFragment | CodePath Android Cliffnotes
DialogFragment is a specialized Fragment used when you want to display an overlay modal window within an activity that floats on top of...
Read more >
Create a fragment - Android Developers
In either case, you need to add a FragmentContainerView that defines the location where the fragment should be placed within the activity's view...
Read more >
Add a Calendar to Android Layout with DateDialog (Kotlin)
In this video, I show how to add a calendar widget to an Android fragment, without taking up too much space. I create...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found