You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法解析com.kizitonwose.calendar.view.CalendarView的XML标签

集成com.kizitonwose.calendar.view.CalendarView时XML标签无法解析

尝试在Android项目中集成com.kizitonwose.calendar.view.CalendarView库,添加依赖并在布局文件中写入XML标签后,无法解析CalendarView对应的XML标签,提示“class not found”错误,但项目编译无问题。

以下是我的XML布局代码:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".StudentPanel.Attendance.StudentAttendanceFragment"
    android:background="@color/bg_color"
    android:padding="16dp">

    <androidx.cardview.widget.CardView
        android:id="@+id/cv_calendar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:cardUseCompatPadding="true"
        android:layout_marginTop="4dp"
        android:foreground="?android:attr/selectableItemBackground"
        app:cardCornerRadius="10dp"
        app:contentPadding="10dp"
        android:backgroundTint="@color/bg_card_color"
        app:cardElevation="4dp">

        <com.kizitonwose.calendar.view.CalendarView
            android:id="@+id/calendarView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:cv_dayViewResource="@layout/calendar_day_layout"
            app:cv_monthHeaderResource="@layout/calendar_day_titles_container" />

    </androidx.cardview.widget.CardView>

</FrameLayout>

我的Gradle依赖配置如下:

plugins {
    id("com.android.application")
}

android {
    // ... (其余现有配置)
}

dependencies {
    // ... (其余现有依赖)

    implementation ("com.github.kizitonwose:CalendarView:1.1.0")
}

恳请各位提供可能的问题原因或解决建议,非常感谢!

内容的提问来源于stack exchange,提问作者Akbar Amin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.01 02:00:14