添加MaterialCalendarView后,Android studio不显示布局预览

问题描述 投票:0回答:1

我想设计包含MaterialCalendarView的ConstraintLayout 但是当我将 MaterialCalendarView 添加到 XML 文件时,Android studio 不显示布局预览: enter image description here

XML 文件:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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=".fragment.SchedulesFragment">


    <TextView
        android:id="@+id/tv_title_fg_schedules"
        android:textSize="24sp"
        android:textStyle="bold"
        android:textColor="@color/gray_black"
        android:gravity="center"
        android:layout_marginTop="10dp"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/schedules" />

    <com.prolificinteractive.materialcalendarview.MaterialCalendarView
        android:id="@+id/calendarView"
        app:layout_constraintTop_toBottomOf="@id/tv_title_fg_schedules"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:mcv_calendarMode="week"
        app:mcv_showOtherDates="all"
        app:mcv_selectionColor="@color/gray" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/rcv_schedules"
        app:layout_constraintTop_toBottomOf="@id/calendarView"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        android:layout_width="match_parent"
        android:layout_height="0dp"/>



</androidx.constraintlayout.widget.ConstraintLayout>

我希望有人能帮助我。非常感谢!!

java android android-xml
1个回答
0
投票

我使用 1.6.0 版本而不是最后一个版本解决了该问题。

将其放入您的 build.gradle 模块中

dependencies {   
implementation 'com.github.prolificinteractive:material-calendarview:1.6.0' 
}
© www.soinside.com 2019 - 2024. All rights reserved.