Skip to content

Using material-calendarview in jetpack compose #1143

@tchouaffe

Description

@tchouaffe

Is it possible to use this calendar within jetpack compose?
I am getting an error doing so.

<?xml version="1.0" encoding="utf-8"?>
  <androidx.constraintlayout.widget.ConstraintLayout 
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

  <com.prolificinteractive.materialcalendarview.MaterialCalendarView
    android:id="@+id/calendar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:mcv_tileHeight="match_parent"
    app:mcv_tileWidth="match_parent" />

  </androidx.constraintlayout.widget.ConstraintLayout>

compose code:

@Composable fun MaterialCalendarView() { val color = MaterialTheme.colorScheme.surface.toArgb() AndroidViewBinding(CalendarViewBinding::inflate) { calendar.setBackgroundColor(color) } }

exception:

Throwing OutOfMemoryError "Failed to allocate a 430032 byte allocation with 297064 free bytes and 290KB until OOM, target footprint 201326592, growth limit 201326592" (VmSize 33280556 kB, recursive case)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions