
这些是布局文件的内容:
<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 – 如何在AlertDialog中显示CalendarView?全部内容,希望文章能够帮你解决android – 如何在AlertDialog中显示CalendarView?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)