2014-07-03 65 views
1

我想用CalendarView显示Dialog。我这是怎么显示DialogAndroid日历视图有什么问题

  AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); 
      View v = getActivity().getLayoutInflater().inflate(R.layout.dialog_calendart, null); 
      builder.setView(v); 
      builder.create().show(); 

,这是布局:

<?xml version="1.0" encoding="utf-8"?> 
<CalendarView xmlns:android="http://schemas.android.com/apk/res/android" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" /> 

此工作正常时,Dialog不包含CalendarView,当它的Dialog需要几秒钟显示我注意到这些线路的负荷在我LogCat

07-03 12:39:37.304 1534-1534/de.something.debug I/Choreographer﹕ Skipped 270 frames! The application may be doing too much work on its main thread. 
07-03 12:39:37.348 1534-1534/de.something.debug D/dalvikvm﹕ GC_FOR_ALLOC freed 1621K, 10% free 18334K/20160K, paused 13ms, total 13ms 

当它终于s ^怎么样了该Dialog看起来是这样的:

enter image description here

我也试图设置一个日期为CalendarView

calendarView.setDate(23423423); 

,但它仍然没有显示安雅日期。

那里出了什么问题?

+0

即使你没能看到这个对话框还啊? “2014年7月” –

回答

2

把这个在您的布局和尝试

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" > 

     <CalendarView 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:minHeight="200dp" 
        android:minWidth="200dp" 
        android:maxDate="01/01/2013" 
       android:minDate="09/01/2012"/> 
        </LinearLayout>