Calendar not display in case of Fragment
See original GitHub issueProblem : When fragment loaded then calendar view not loaded its like blank mention in the screenshot.
Screenshot
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:
- Created 5 years ago
- Reactions:6
- Comments:13
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I tried to put the CalendarView inside ConstraintLayout and it works perfectly…
Moving my Framelayout from a Linear Layout to a constraint layout fixed the issue for me.