我的活动中有一个日历视图,正在使用 Caldroid 库来显示事件。我面临一个问题,对于日历视图,它在我的活动中显示两个日历。
calendarView = (CalendarView) findViewById(R.id.cvCalendar);
final CaldroidFragment caldroidFragment = new CaldroidFragment();
Bundle args = new Bundle();
Calendar cal = Calendar.getInstance();
args.putInt(CaldroidFragment.MONTH, cal.get(Calendar.MONTH) + 1);
args.putInt(CaldroidFragment.YEAR, cal.get(Calendar.YEAR));
caldroidFragment.setArguments(args);
android.support.v4.app.FragmentTransaction t = getSupportFragmentManager().beginTransaction();
t.replace(R.id.cvCalendar, caldroidFragment);
t.commit();
布局文件如下所示:`
<RelativeLayout><CalendarView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/cvCalendar"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" /></RelativeLayout>
在 logcat 中也收到警告,如下所示
12-15 13:26:22.291 1019-1057/? W/PackageManager: Code path for pkg : com.example.android1.calender changing from /data/app/com.example.android1.calender-29.apk to /data/app/com.example.android1.calender-30.apk
12-15 13:26:22.291 1019-1057/? W/PackageManager: Resource path for pkg : com.example.android1.calender changing from /data/app/com.example.android1.calender-29.apk to /data/app/com.example.android1.calender-30.apk
12-15 13:26:22.481 1019-1057/? W/PackageManager: Not granting permission android.permission.INTERACT_ACROSS_USERS_FULL to package com.example.android1.calender (protectionLevel=2 flags=0x48be46)
12-15 13:26:26.085 31128-31128/? E/dalvikvm: >>>>> com.example.android1.calender [ userId:0 | appId:10184 ]
12-15 13:26:54.516 1019-1044/? W/ActivityManager: Force removing ActivityRecord{42e2f170 u0 com.example.android1.calender/.register t21}: app died, no saved state
12-15 13:26:56.418 1019-1057/? W/PackageManager: Code path for pkg : com.example.android1.calender changing from /data/app/com.example.android1.calender-30.apk to /data/app/com.example.android1.calender-31.apk
12-15 13:26:56.418 1019-1057/? W/PackageManager: Resource path for pkg : com.example.android1.calender changing from /data/app/com.example.android1.calender-30.apk to /data/app/com.example.android1.calender-31.apk
12-15 13:26:56.668 1019-1057/? W/PackageManager: Not granting permission android.permission.INTERACT_ACROSS_USERS_FULL to package com.example.android1.calender (protectionLevel=2 flags=0x48be46)
12-15 13:26:59.951 31755-31755/? E/dalvikvm: >>>>> com.example.android1.calender [ userId:0 | appId:10184 ]