首先,抱歉我的英语不好:(
我在Android Studio中使用通用CalendarView组件。此CalendarView处于活动Calendar.class。
我有一个主要活动(Home.class),在这个活动中我有一个按钮去Calendar.class。 我在我的智能手机(LG G2非常快的智能手机)中测试了应用程序,当我在日历按钮中显示时,4秒后日历活动打开,而不是立即打开。
我在Android DDMS中找到了这个:
03-27 17:13:45.908 17683-17683/com.alrescate.azvis I/ViewRootImpl﹕ ViewRoot's Touch Event : Touch Down
03-27 17:13:45.958 17683-17683/com.alrescate.azvis I/ActivityManager﹕ Timeline: Activity_launch_request id:com.alrescate.azvis time:283108095
03-27 17:13:45.958 17683-17683/com.alrescate.azvis I/ViewRootImpl﹕ ViewRoot's Touch Event : Touch UP
03-27 17:13:47.128 17683-17683/com.alrescate.azvis D/dalvikvm﹕ GC_FOR_ALLOC freed 7452K, 31% free 17265K/25004K, paused 31ms, total 33ms
03-27 17:13:47.418 17683-17683/com.alrescate.azvis D/dalvikvm﹕ GC_FOR_ALLOC freed 2138K, 32% free 17174K/25004K, paused 14ms, total 14ms
03-27 17:13:47.698 17683-17683/com.alrescate.azvis D/dalvikvm﹕ GC_FOR_ALLOC freed 2047K, 32% free 17174K/25004K, paused 15ms, total 15ms
03-27 17:13:47.968 17683-17683/com.alrescate.azvis D/dalvikvm﹕ GC_FOR_ALLOC freed 2047K, 32% free 17174K/25004K, paused 14ms, total 14ms
03-27 17:13:48.218 17683-17683/com.alrescate.azvis D/dalvikvm﹕ GC_FOR_ALLOC freed 2047K, 32% free 17175K/25004K, paused 14ms, total 14ms
03-27 17:13:48.538 17683-17683/com.alrescate.azvis D/dalvikvm﹕ GC_FOR_ALLOC freed 2047K, 32% free 17175K/25004K, paused 15ms, total 15ms
03-27 17:13:48.818 17683-17683/com.alrescate.azvis D/dalvikvm﹕ GC_FOR_ALLOC freed 2047K, 32% free 17175K/25004K, paused 15ms, total 15ms
03-27 17:13:49.088 17683-17683/com.alrescate.azvis D/dalvikvm﹕ GC_FOR_ALLOC freed 2048K, 32% free 17174K/25004K, paused 15ms, total 15ms
03-27 17:13:49.378 17683-17683/com.alrescate.azvis D/dalvikvm﹕ GC_FOR_ALLOC freed 2047K, 32% free 17174K/25004K, paused 15ms, total 15ms
03-27 17:13:49.648 17683-17683/com.alrescate.azvis D/dalvikvm﹕ GC_FOR_ALLOC freed 2048K, 32% free 17174K/25004K, paused 15ms, total 15ms
03-27 17:13:49.918 17683-17683/com.alrescate.azvis D/dalvikvm﹕ GC_FOR_ALLOC freed 2047K, 32% free 17174K/25004K, paused 14ms, total 14ms
03-27 17:13:50.008 17683-17683/com.alrescate.azvis I/ActivityManager﹕ Timeline: Activity_idle id: android.os.BinderProxy@42e1e730 time:283112144
这是我的代码Home.class:
if(id == R.id.action_calendar) {
Intent in = new Intent(getApplicationContext(), Calendar.class);
startActivity(in);
}
和Calendar.class:
Intent in = new Intent(getApplicationContext(), Home.class);
in.putExtra("calendar_date", fecha);
startActivity(in);
和activity_calendar.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.alrescate.azvis.Calendar">
<CalendarView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/calendario"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />