Android CalenderView - change scroll direction to vertical

拈花ヽ惹草 提交于 2019-12-06 14:01:11

问题


I'm using a calendarView in my app inside a navigation drawer to select different days and everything works fine except for swiping to the left on the calendarView to get to the next month (swiping to right changes to the previous month correctly), since this is the swipe gesture that closes the drawer.

Is it possible to change the scroll direction of the calendar to vertical instead of horizontal? I want to implement this so users don't solemnly need to rely on the buttons to switch between months.

This is the code from fragment_navigation_drawer.xml

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


    <RelativeLayout
        android:id="@+id/nav_header_container"
        android:layout_width="match_parent"
        android:layout_height="140dp"
        android:background="@color/colorPrimary">

        <ImageView
            android:layout_width="70dp"
            android:layout_height="70dp"
            android:src="@drawable/ic_profile"
            android:scaleType="fitCenter"
            android:layout_centerInParent="true"
            android:contentDescription="@string/app_icon"/>

    </RelativeLayout>

    <CalendarView
        android:id="@+id/calendarView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    </CalendarView>

</LinearLayout>

which looks like this in my app:

来源:https://stackoverflow.com/questions/37822403/android-calenderview-change-scroll-direction-to-vertical

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!