Android CalendarView滚动视图-日历卡在月份
我正在ScrollView中使用CalendarView。最小SDK为17,目标SDK为25,编译SDK为25,构建工具版本为25.0.3。 我遇到的问题是滚动。在API v23及更高版本的设备上运行此功能似乎可以正常工作,但对于需要激活ScrollView的较低API,则无法将日历滚动到另一个月 从我所看到的情况来看,这似乎已经在API v23中得到了修复,通过使日历水平滚动,而ScrollView垂直滚动。使用带有v22的设备,它们都垂直滚动,因此当需要激活ScrollView时,CalendarView滚动到另一个月不起作用。至少在我看来是这样的 在我努力寻找解决方案的过程中,以下帖子中user@Joel提供的答案似乎通过提供自定义滚动视图解决了这一问题: 我很惊讶,经过这么长时间,它还没有被v22和之前版本的Android团队修复。上述用户于2010年4月16日发布了原始修复程序 虽然我很高兴上面的SO帖子已经解决了这个问题,但是有没有其他本地的方法来解决这个问题呢?我唯一真正关心的是,定制ScrollView可能无法为所有可能的情况提供解决方案。我只为API v22和更低版本实现了自定义ScrollView,而对于API v23和更高版本,我使用本机ScrollView 编辑:根据请求添加的示例。v23及以上版本中的OK 但是,在v22中,仿真器环境不能每月更改 导入android.os.Bundle; 导入android.support.v7.app.AppActivity 公共类活动Main扩展了AppCompatActivity{Android CalendarView滚动视图-日历卡在月份,android,scrollview,calendarview,Android,Scrollview,Calendarview,我正在ScrollView中使用CalendarView。最小SDK为17,目标SDK为25,编译SDK为25,构建工具版本为25.0.3。 我遇到的问题是滚动。在API v23及更高版本的设备上运行此功能似乎可以正常工作,但对于需要激活ScrollView的较低API,则无法将日历滚动到另一个月 从我所看到的情况来看,这似乎已经在API v23中得到了修复,通过使日历水平滚动,而ScrollView垂直滚动。使用带有v22的设备,它们都垂直滚动,因此当需要激活ScrollView时,Calen
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
请在此处张贴您的代码我已根据要求用示例更新了问题。请在此处张贴您的代码我已根据要求用示例更新了问题。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@color/colorPrimary"
app:tabGravity="fill"
app:tabMode="fixed" />
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/lay_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tabs"
android:orientation="vertical">
<!-- Selected Date -->
<TextView
android:id="@+id/txv_date_and_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:lines="1"
android:padding="4dip"
android:text="This is Some Text"
android:textSize="18sp"
android:textStyle="bold" />
<!-- TIME UNTIL DATE AND TIME -->
<TextView
android:id="@+id/txv_remaining_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/txv_date_and_time"
android:gravity="center_horizontal"
android:lines="1"
android:padding="4dip"
android:text="This is some more text"
android:textColor="@color/colorAccent"
android:textSize="18sp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/lay_scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/lay_detail"
android:layout_marginBottom="65dip"
android:layout_marginTop="10dip"
android:orientation="vertical">
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/lay_fragment"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_gravity="top|center"
android:layout_marginBottom="0dip"
android:layout_marginTop="0dip"
android:layout_weight="1"
android:orientation="vertical">
<CalendarView
android:id="@+id/date_picker"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbarAlwaysDrawVerticalTrack="false"
android:layout_marginBottom="25dip"
android:isScrollContainer="true"
android:scrollbarAlwaysDrawHorizontalTrack="true"
android:orientation="horizontal"
android:textSize="12sp" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottom_nav"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:layout_alignParentBottom="true"
/>