在Google Stock Android日历中存在多个视图(月,周,议程,周),从Google Android Sources Repositories下载的源代码具有相同的应用程序,通过探索代码包命名com.android.calendar
有负责渲染这些活动的主要观点:如何在自定义应用中使用Android股票日历(月,日,星期)
硬代码周围的工作,我用了两个包com.android.calendar.month
和com.android.calendar
,但不能达到我的目标,这是我用过的一个样本:
和主下面的代码:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
,这里是我的XML代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/month"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:paddingTop="1dip"
android:background="@null">
<TextView android:id="@+id/month_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dip"
android:visibility="gone"
style="@style/MonthView_MiniMonthLabel" />
<include android:id="@+id/day_names" layout="@layout/full_month_header" />
<View
android:background="@color/calendar_grid_line_inner_vertical_color"
android:layout_height="1px"
android:layout_width="match_parent" />
<com.android.calendar.month.MonthListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawSelectorOnTop="false" />
</LinearLayout>
到这里的代码工作正常,但有一个空白屏幕和一个操作栏,如果我的问题不明确,请尝试编辑它。
What should be done to include Calendar Views (Month, Week, Day) in a custom application ?
你有什么需要吗?除了简单的选择日期之外,还有什么? –
你是否知道这个问题? –
@MouhamadLamaa不,我还没有到现在 –