当前位置: 首页 > 面试题库 >

找不到Android CalendarView类

司寇光华
2023-03-14
问题内容

我正在为要在应用程序中使用的日历设计xml格式,但无法将日历显示在 图形布局中

相反,我得到以下“错误”:

找不到以下类:-CalendarView(更改为android.widget.CalendarView,修复构建路径,编辑XML)

此项目的最低SDK版本为14,目标版本为15。

这是我的 XML 代码:

<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>

非常感激!谢谢!


问题答案:

您可能正在Android Target 16上预览屏幕。尝试将Android Target 15用于图形布局编辑器(ADT
20中顶部的android图标)。似乎Android Target 16存在问题。

注意:您 不需要 仅在图形布局编辑器中设置项目目标。



 类似资料:
  • 问题内容: 我已经安装了两个jdk-jdk 1.5和jdk 1.8。我有以下Ant build.xml配置文件: 在安装jdk1.8之前,从Eclipse调用的Ant成功编译了所有源代码。但是现在,我有以下错误消息: 我的JAVA_HOME和JRE_HOME: 并在Eclipse JRE中将其设置为1.5。Java 1.8在安装过程中会设置一些配置吗? 问题答案: 已知低于1.9.0的Apache

  • 我已经安装了两个JDK--JDK1.5和JDK1.8。我有以下Ant build.xml配置文件: 在安装JDK1.8之前,从Eclipse调用的Ant成功地编译了所有源代码。但现在,我有以下错误消息: 我的JAVA_HOME和JRE_HOME: 并在Eclipse JRE中设置为1.5。Java 1.8在安装过程中是否设置了一些配置?

  • 问题内容: 我试图使用SpringJUnit4ClassRunner创建一个单元测试,但是每次执行测试时,它都说它无法使用mvn install找到SpringJUnit4ClassRunner。 这是我的代码 这是我的POM文件: 我正在使用适合IDE的springSource工具开发此spring mvc应用程序,并且在IDE上将SpringJUnit4ClassRunner突出显示为错误,尽

  • 问题内容: 我正在尝试使用Jersey框架构建RESTFul客户端,因此添加了以下类: 但是,即使我在WEB-INF / lib和应用程序类路径下有以下jar,我也找不到未找到的错误类ClientBuilder: 所以有人可以告诉我我在这里想念的那个罐子吗?在哪里可以找到它?我搜索了Web,发现唯一具有ClientBuilder的jar与RESTEasy框架有关,所以我认为这没有关系。 谢谢你的时

  • 问题内容: 我一直在尝试在脚本中打开Word文档,但收到相同的错误。 我的代码: 我试图更改和删除部分中的分号。 仍然出现相同的错误。 我在Mac和基于Linux的虚拟主机上使用的。 问题答案: 从PHP 5.4.5开始,COM和DOTNET不再内置在php内核中。您必须在php.ini中添加COM支持: 否则,您将在错误日志中看到此消息:致命错误:未找到类“ COM” 该扩展包含在Windows

  • 问题内容: 我在Magento应用程序的页面上发现错误;当我访问它时,它总是显示此消息错误: 致命错误:在第95行的/home/…/lib/Zend/Feed/Abstract.php中找不到类’DOMDocument’ 你能给我解决办法吗?我正在使用magento 1.4.1.1。 问题答案: 您需要安装DOM扩展。您可以使用以下命令在Debian / Ubuntu上执行此操作: 在Centos

  • 问题内容: JPype是一个了不起的项目,因为我允许直接从实例化一个。 不幸的是,我陷入了第一步。 我有源代码( ): 使用以下命令将其编译为类: 因此,A.class位于 文件夹中。 我有以下源代码: 运行它时,出现以下错误: 由于找不到A类,可能是与CLASSPATH相关的问题,但是我无法意识到我做错了什么。 有什么线索吗? 编辑1: 问题仍然存在。但是,只是增加了我的问题,如果我使用本机Ja

  • 问题内容: 我正在尝试将Spring与Hibernate结合使用。View使用JSTL。当我在浏览器中打开页面时,我看到错误: 这是我与pom.xml的依赖关系的一部分,与此相关: 哪里有问题?我正在使用tomcat版本6。 问题答案: 问题出在web.xml中的servlet版本错误。我已经做到2.5了,所有的作品。