Android Caldroid库日历未在横向视图中显示所有日期

Android Caldroid库日历未在横向视图中显示所有日期,android,calendar,Android,Calendar,我正在使用库将日历显示为对话框片段。工作正常,但在横向模式下,日历不会显示所有日期(上周缺失)。见图片: 我已经在库中检查了这个视图的xml及其使用视图页面,我不知道如何修改它。还有一个疑问,如何从当前日期禁用所有日期 编辑: (我是Caldroid的作者) 日历中的单元格是方形的,因此在横向模式和小布局下,没有足够的空间。我没有此模式的最佳解决方案,但您可以尝试以下几点: 不显示对话框标题(“选择日期”)。它将为日历提供更多空间 在初始参数中将日历中的sixth\u WEEKS\u设置为

我正在使用库将日历显示为对话框片段。工作正常,但在横向模式下,日历不会显示所有日期(上周缺失)。见图片:

我已经在库中检查了这个视图的xml及其使用视图页面,我不知道如何修改它。还有一个疑问,如何从当前日期禁用所有日期

编辑:


(我是Caldroid的作者)

日历中的单元格是方形的,因此在横向模式和小布局下,没有足够的空间。我没有此模式的最佳解决方案,但您可以尝试以下几点:

  • 不显示对话框标题(“选择日期”)。它将为日历提供更多空间

  • 在初始参数中将日历中的
    sixth\u WEEKS\u设置为“false”

  • 提供非正方形的自定义单元格


让我知道什么最适合您,这样我就可以改进库,或者更好地向我发送请求:)

在InfiniteViewer中摆脱onMeasure方法,并用以下内容替换calendar\u view.xml内容:

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/caldroid_white"
    android:orientation="vertical" >

    <RelativeLayout
        android:id="@+id/calendar_title_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true">

        <Button
            android:id="@+id/calendar_left_arrow"
            android:layout_width="50dp"
            android:layout_height="44dp"
            android:layout_alignParentLeft="true"
            android:background="@drawable/left_arrow" />

        <TextView
            android:id="@+id/calendar_month_year_textview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="6dp"
            android:layout_toLeftOf="@+id/calendar_right_arrow"
            android:layout_toRightOf="@+id/calendar_left_arrow"
            android:gravity="center_horizontal"
            android:textIsSelectable="true"
            android:textSize="21sp" />

        <Button
            android:id="@+id/calendar_right_arrow"
            android:layout_width="50dp"
            android:layout_height="44dp"
            android:layout_alignParentRight="true"
            android:background="@drawable/right_arrow" />
    </RelativeLayout>

    <GridView
        android:layout_below="@+id/calendar_title_view"
        android:id="@+id/weekday_gridview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="-10dp"
        android:numColumns="7"
        android:stretchMode="columnWidth" >
    </GridView>

    <com.antonyt.infiniteviewpager.InfiniteViewPager
        android:layout_below="@+id/weekday_gridview"
        android:layout_alignParentBottom="true"
        android:id="@+id/months_infinite_pager"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</RelativeLayout>


实际上,我刚刚使用了库中的dialogCaldroidFragment类。。所以库中的xml被更新了,那么将日历中的六周设置为false实际上是做什么的呢?它只是不强迫日历总是显示六个完整的星期,这当然是日历覆盖一个完整的月份所需要显示的最大值。当我试图将日历压缩一点时,我问道,是纵向的,而不是对话。你认为实现这一目标最简单/最好的方法是什么?顺便说一句,感谢您的库。日历月份可以有4、5或6周,这将转换为caldroid中的4、5或6行。将日历中的六周设置为true将显示包含6行的日历,其中包含冗余行。将其设置为false将强制日历换行为4、5或6行。如果要压缩日历,最好提供自定义单元格。
    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/caldroid_white"
    android:orientation="vertical" >

    <RelativeLayout
        android:id="@+id/calendar_title_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true">

        <Button
            android:id="@+id/calendar_left_arrow"
            android:layout_width="50dp"
            android:layout_height="44dp"
            android:layout_alignParentLeft="true"
            android:background="@drawable/left_arrow" />

        <TextView
            android:id="@+id/calendar_month_year_textview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="6dp"
            android:layout_toLeftOf="@+id/calendar_right_arrow"
            android:layout_toRightOf="@+id/calendar_left_arrow"
            android:gravity="center_horizontal"
            android:textIsSelectable="true"
            android:textSize="21sp" />

        <Button
            android:id="@+id/calendar_right_arrow"
            android:layout_width="50dp"
            android:layout_height="44dp"
            android:layout_alignParentRight="true"
            android:background="@drawable/right_arrow" />
    </RelativeLayout>

    <GridView
        android:layout_below="@+id/calendar_title_view"
        android:id="@+id/weekday_gridview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="-10dp"
        android:numColumns="7"
        android:stretchMode="columnWidth" >
    </GridView>

    <com.antonyt.infiniteviewpager.InfiniteViewPager
        android:layout_below="@+id/weekday_gridview"
        android:layout_alignParentBottom="true"
        android:id="@+id/months_infinite_pager"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</RelativeLayout>