android – 如何在AlertDialog中显示CalendarView?

我正在尝试在警报对话框中显示CalendarView,但所有显示的都是月/年和星期几.
这些是布局文件内容
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/myLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
<CalendarView
    android:id="@+id/calendarID"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:contentDescription="@string/cal_desc"
    android:maxDate="01/01/2013"
    android:minDate="09/01/2012"
    android:showWeekNumber="false"
    android:tag="my tag" />
</LinearLayout>

这是我用于将布局添加到AlertDialog的代码

LayoutInflater inflater = (LayoutInflater)getApplicationContext().getSystemService
              (Context.LAYOUT_INFLATER_SERVICE);
LinearLayout ll= (LinearLayout)inflater.inflate(R.layout.myLayout,null,false);
CalendarView cv = (CalendarView) ll.getChildAt(0);
cv.setonDatechangelistener(new OnDatechangelistener() {

        @Override
        public void onSelectedDayChange(CalendarView view,int year,int month,int dayOfMonth) {
            // Todo Auto-generated method stub
            initScheduleEvent();
        }
    });
new AlertDialog.Builder(MomAppActivity.this)
    .setTitle("Event Calendar")
    .setMessage("Click to schedule or view events.")
    .setView(ll)
    .setPositiveButton("Ok",new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog,int whichButton) {
            //do nothing...yet
        }
    }).setNegativeButton("Cancel",int whichButton) {
            // Do nothing.
        }
    }
    ).show();

任何帮助都会非常感激,因为我完全被难倒了.该应用程序没有给我任何错误继续.

解决方法

要正确显示日历,需要最小高度.其余代码工作正常.

相关文章

这篇“android轻量级无侵入式管理数据库自动升级组件怎么实现...
今天小编给大家分享一下Android实现自定义圆形进度条的常用方...
这篇文章主要讲解了“Android如何解决字符对齐问题”,文中的...
这篇文章主要介绍“Android岛屿数量算法怎么使用”的相关知识...
本篇内容主要讲解“Android如何开发MQTT协议的模型及通信”,...
本文小编为大家详细介绍“Android数据压缩的方法是什么”,内...