0

How can I create layout with equal width and height for CalendarView? Answers to the same question for ImageView don't work with CalendarView:

ImageView - have height match width?

Current layout:

    <CalendarView
    android:id="@+id/calendarView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

enter image description here

Dmitry
  • 13,747
  • 21
  • 101
  • 183

1 Answers1

1

You need to get width of the device at runtime. And set through layout params like new LayoutParams(width_of_device , width_of_device) and apply layout params. So you can set equal width and height of calendar view.

Hkh
  • 347
  • 1
  • 9