Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android CalendarView class cannot be found

Im designing the xml format for a calendar to be used in an app, but I cant get the calendar to show in the graphical layout shower.

Instead I get the following 'error':

The following classes could not be found: - CalendarView (Change to android.widget.CalendarView, Fix Build Path, Edit XML)

The min SDK version for this project is 14 and its target version is 15.

Here is my XML code:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:orientation="horizontal" >          <RelativeLayout android:id="@+id/top"             android:layout_width="fill_parent"             android:layout_height="wrap_content">                 <Button android:id="@+id/dash"                     android:layout_height="wrap_content"                     android:layout_width="wrap_content"                     android:maxWidth="200dp"                     android:maxHeight="10dp"                     android:text="DASHBOARD"                     android:textAppearance="?android:attr/textAppearanceSmall"                     android:layout_alignParentLeft="true"/>                  <TextView                     android:id="@+id/textView1"                     android:layout_width="wrap_content"                     android:layout_height="wrap_content"                     android:layout_centerInParent="true"                     android:paddingBottom="10px"                     android:paddingTop="10px"                     android:text="Calendar"                     android:textAppearance="?android:attr/textAppearanceLarge"/>                 <Button                     android:id="@+id/plusButton"                     style="?android:attr/buttonStyleSmall"                     android:layout_width="wrap_content"                     android:layout_height="wrap_content"                     android:layout_alignParentRight="true"                     android:text="+"                     android:textAppearance="?android:attr/textAppearanceLarge"/>         </RelativeLayout>         <CalendarView             android:id="@+id/calview"             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:layout_below="@+id/top"             android:maxHeight="300dp" />          <RelativeLayout android:id="@+id/infoScroll"             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:layout_below="@+id/calview">              <ScrollView                 android:id="@+id/scrollView1"                 android:layout_width="fill_parent"                 android:layout_height="wrap_content"                 android:maxHeight="100dp">                  <ListView                     android:id="@+id/listView1"                     android:layout_width="match_parent"                     android:layout_height="match_parent" >                 </ListView>              </ScrollView>         </RelativeLayout>         <RelativeLayout android:id="@+id/bottomBar"             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:layout_below="@+id/infoScroll">             <Button android:id="@+id/todayButton"                 android:layout_height="wrap_content"                     android:layout_width="wrap_content"                     android:layout_alignParentLeft="true"                     android:text="Today"                 android:textAppearance="?android:attr/textAppearanceSmall"/>              <Button android:id="@+id/listButton"                 android:layout_height="wrap_content"                     android:layout_width="wrap_content"                     android:layout_toLeftOf="@+id/dayButton"                     android:text="List"                     android:textAppearance="?android:attr/textAppearanceSmall"/>          <Button android:id="@+id/dayButton"                 android:layout_height="wrap_content"                     android:layout_width="wrap_content"                     android:layout_centerInParent="true"                     android:text="Day"                 android:textAppearance="?android:attr/textAppearanceSmall"/>          <Button             android:id="@+id/monthButton"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_toRightOf="@+id/dayButton"             android:text="Month"             android:textAppearance="?android:attr/textAppearanceSmall"/>          <Button android:id="@+id/PeopleButton"             android:layout_height="wrap_content"                 android:layout_width="wrap_content"                     android:layout_alignParentRight="true"                 android:text="People"                 android:textAppearance="?android:attr/textAppearanceSmall"/>            </RelativeLayout>  </RelativeLayout> 

Much appreciated! Thanks!

like image 467
EndingWithAli Avatar asked Jul 06 '12 16:07

EndingWithAli


People also ask

What is calendarview class in Android?

This class is a calendar widget for displaying and selecting dates. [Android.Runtime.Register ("android/widget/CalendarView", DoNotGenerateAcw=true)] public class CalendarView : Android.Widget.FrameLayout [<Android.Runtime.Register ("android/widget/CalendarView", DoNotGenerateAcw=true)>] type CalendarView = class inherit FrameLayout

What is calendar view widget?

Calendar View Tutorial With Example In Android Studio In Android, Calendar View widget was added in API level 11 (Android version 3.0) which means this view is only supported in the device that are running on Android 3.0 and higher version. It is used for displaying and selecting dates.

What are the methods of calendarview?

Let’s we discuss some important methods of Calendar View that may be called in order to manage the CalendarView. 1. getDate (): This method is used to get the selected date of CalendarView in milliseconds since January 1, 1970 00:00:00 in user’s preferred time zone.

How to set minimum and maximum Date shown in calendarview?

Developer can also set minimum and maximum date shown in calendar view. Let’s we discuss some important methods of Calendar View that may be called in order to manage the CalendarView. 1. getDate (): This method is used to get the selected date of CalendarView in milliseconds since January 1, 1970 00:00:00 in user’s preferred time zone.


1 Answers

you might be previewing your screen on Android Target 16. Try using Android Target 15 for Graphic Layout Editor (android icon on the top, in ADT 20). Looks like there is issue with Android Target 16.

NOTE: You don't need to set the project target just the target in the graphical layout editor.

like image 130
havexz Avatar answered Sep 27 '22 16:09

havexz