<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".fragments.FirstFragment"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/text_support" android:visibility="gone" /> <CalendarView android:id="@+id/calendar_one" android:layout_width="match_parent" android:layout_height="wrap_content" /> <CalendarView android:id="@+id/calendar_two" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/calendar_one" /> </RelativeLayout> </ScrollView>
MainActivity.java
————————–
public class MainActivity extends AppCompatActivity { private CalendarView calendar_one, calendar_two; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); calendar_one = view.findViewById(R.id.calendar_one); calendar_two = view.findViewById(R.id.calendar_two); //Disable Previous dates from Current Date calendar_one.setMinDate(System.currentTimeMillis() - 1000); //Disable Future dates from Current Date calendar_two.setMaxDate(System.currentTimeMillis() + 1000); } }