【问题标题】:How can I create layout with equal width and height for CalendarView?如何为 CalendarView 创建宽度和高度相等的布局?
【发布时间】:2018-05-09 05:42:51
【问题描述】:

如何为CalendarView 创建宽度和高度相等的布局? ImageView 的相同问题的答案不适用于 CalendarView

ImageView - have height match width?

当前布局:

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

【问题讨论】:

    标签: android layout calendarview


    【解决方案1】:

    您需要在运行时获取设备的宽度。并通过布局参数设置,如 new LayoutParams(width_of_device , width_of_device) 并应用布局参数。所以你可以设置日历视图的宽度和高度相等。

    【讨论】:

      猜你喜欢
      • 2011-08-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多