CalendarView不显示某些较小屏幕尺寸的所有日期

时间:2016-04-07 04:30:53

标签: android android-layout google-calendar-api android-xml android-calendar

这是我的日历视图

<CalendarView
    android:id="@+id/calendarView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:layout_above="@+id/tableLayout"
    android:layout_alignParentTop="true" />

下面我有3个按钮,下面给出了xml

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="wrap_content"
    android:id="@+id/tableLayout"
    android:padding="5dp" android:stretchColumns="0"
    android:textAlignment="center"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true">

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:id="@+id/tableRow1">
        <Button
            android:id="@+id/trackAttendance"
            android:layout_height="wrap_content"
            android:text="Track Class Attendance"
            android:paddingLeft="30dp"
            android:paddingRight="30dp"
            android:layout_marginTop="5dp"
            android:layout_marginBottom="5dp"
            android:layout_width="50dp"
            android:textColor="#ffffff"
            android:textSize="15dp"
            android:background="@drawable/mybuttons"> </Button>
    </TableRow>
    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:id="@+id/tableRow2">
        <Button
            android:id="@+id/trackSessions"
            android:layout_height="wrap_content"
            android:text="Track Study Sessions"
            android:paddingLeft="30dp"
            android:paddingRight="30dp"
            android:layout_marginTop="5dp"
            android:layout_marginBottom="5dp"
            android:layout_width="50dp"
            android:textColor="#ffffff"
            android:textSize="15dp"
            android:background="@drawable/mybuttons"> </Button>
    </TableRow>
    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:id="@+id/tableRow3">
        <Button
            android:id="@+id/trackActivities"
            android:layout_height="wrap_content"
            android:text="Track Class Activities"
            android:paddingLeft="30dp"
            android:paddingRight="30dp"
            android:layout_marginTop="5dp"
            android:layout_marginBottom="5dp"
            android:layout_width="50dp"
            android:textColor="#ffffff"
            android:textSize="15dp"
            android:background="@drawable/mybuttons"> </Button>
        </TableRow>

</TableLayout>

当我在屏幕尺寸小于4.5英寸的手机上运行时,我无法查看日历视图中的所有日期。显示如下所示

enter image description here

如果不使用股票谷歌日历视图,是否有任何解决方法。 提前致谢

1 个答案:

答案 0 :(得分:2)

这是正在发生的因为按钮的高度为wrap_content ..

所以按钮重叠日历视图

尝试使用ScrollView创建布局参考This

LinearLayoutweightsumlayout_Weight一起使用。请参阅This