2012-12-25 49 views
0

我正在開發一個應用程序,它基本上應該從網站下載事件列表,然後在佈局等日曆中查看它們。我已經介紹了第一部分。但我不知道如何製作一個網格佈局(一個座標軸上的tume和第二個座標軸上的日期),並且基於開始和結束時間將listview形式的事件放置在網格上。我只需要一個提示如何開始這個。問題是我必須根據用戶選擇添加事件。以編程方式製作像佈局的自定義日曆

回答

1

這將創建壓延像格..程式設計

LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); 

    /* INFLATE MAIN TABLE LAYOUT */ 
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.table_root, null); 
    TableLayout tbl = (TableLayout) root.findViewById(R.id.tblLayout); 

     this.setContentView(root); 

     ViewGroup row = (ViewGroup) inflater.inflate(R.layout.table_row, root, false); 

    /* GENERIC LOOP FOR CREATING TABLE */ 

    int count = 1; 

    for (int day = 0; day < calendarCount; day++) 
    { 
     row.addView(day); 

     if (count <= weekCount) { 
      root.addView(row); 
      row = (ViewGroup) inflater.inflate(R.layout.popup_row, root, false); 
     } 

     count++; 

    } 

還可以看到..
http://w2davids.wordpress.com/android-simple-calendar/

相關問題