TergOfSky
TergOfSky

Reputation: 107

making a custom calendar like layout programmatically

I am developing an app which basically should download a list of events from a website and then views them in a in a calendar like layout. I already covered the first part. But I don't have an idea how to make a layout which would be a grid (tume on one axis and date on second axis) and the events in form of listview would be placed on the grid based on the start and end time. I just need a hint how to start this. The problem is that i have to add the events depending on user choices.

Upvotes: 0

Views: 1593

Answers (1)

ridoy
ridoy

Reputation: 6332

This will create calender like grid programtically..

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++;
}

Also you can see..
http://w2davids.wordpress.com/android-simple-calendar/

Upvotes: 1

Related Questions