Hi All!!
I need to create a schedule view like a grid with a WRAP_CONTENTed first
'Description' column and 24 'hour'-columns with the same width. This should
be created programmatically.
I've tried a different variants, but 'hour'-columns seem like a
WRAP_CONTENTED too.  :-(
 XML-part:
......
 <HorizontalScrollView
  android:layout_width="wrap_content"
  android:layout_height="wrap_content">
  <TableLayout
   android:id="@+id/laytBluetooth"
   android:layout_height="wrap_content"
   android:layout_width="wrap_content"
   android:stretchColumns="0">
  </TableLayout>
 </HorizontalScrollView>
.....
Java-part:
     TableLayout                  layout;
     TableRow                     row;
     TextView                     txtHeader;
     TableRow.LayoutParams        lpHeader, lpHourHdr;
     lpHeader    = new
TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,

TableRow.LayoutParams.WRAP_CONTENT,
                                             *6f*);
     lpHourHdr   = new
TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,

TableRow.LayoutParams.WRAP_CONTENT,
                                             *1f*);

     ///////////////////////////////////////////////////////////
     // Generates grid
     ///////////////////////////////////////////////////////////
     layout = (TableLayout)findViewById(R.id.laytBluetooth);

     //////////////////////////
     // Header
     //////////////////////////
     row = new TableRow(this);
     row.setWeightSum(30f);
     txtHeader = new TextView(this);
     txtHeader.setText(R.string.hdrHour);
     txtHeader.setLayoutParams(*lpHeader*);
     row.addView(txtHeader);
     // Hours
     for (int hour = 0; hour < 24; hour++) {
      layout.*setColumnStretchable*(hour, true);
      txtHeader = new TextView(this);
      txtHeader.setLayoutParams(*lpHourHdr*);
      txtHeader.setText(String.valueOf(hour) + " ");
      txtHeader.setGravity(Gravity.CENTER_HORIZONTAL);
      row.addView(txtHeader);
     }
     layout.addView(row, new TableLayout.LayoutParams(
                TableLayout.LayoutParams.WRAP_CONTENT,
                TableLayout.LayoutParams.WRAP_CONTENT));

Could anyone help me?
-------
Peter.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to