It seems very simple, but by chance I checked it and it works well. Hope this also helps you ...
First, create a separate XML file that contains only CalendarView. Named "cal_view.xml"
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <android.widget.CalendarView android:layout_width="200dp" android:layout_height="200dp" /> </LinearLayout>
Then include this xml file in the main xml file, like the following. Instead of your CalanderView, include the xml file.
<include android:id="@+id/subCategory" layout="@layout/cal_view" />
source share