I have a TableLayout
that I create from xml file
<ScrollView
android:id="@+id/ScrollViewScheme"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="horizontal|vertical"
android:layout_alignStart="@+id/theIdforLinearView"
android:layout_below="@+id/theIdforLinearView">
<HorizontalScrollView
android:id="@+id/horizontalView"
android:layout_height="match_parent"
android:scrollbars="horizontal|vertical"
android:layout_width="fill_parent"
android:layout_marginTop="5dip">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_alignTop="@+id/ScrollViewScheme"
android:layout_alignParentStart="true">
<TableLayout
android:background="@drawable/cell_shape"
android:id="@+id/tableLayout1"
android:layout_width="783dp"
android:layout_height="1000dp"
android:shrinkColumns="*"
android:stretchColumns="*">
<TableRow
android:id="@+id/tableRow1"
android:layout_height="wrap_content"
android:layout_width="0dp"
>
<TextView
android:background="@drawable/cell_shape"
android:id="@+id/TextView04"
android:text="Hour/Day"
android:textStyle="bold"
android:typeface="serif"
android:layout_weight="1"
android:layout_column="0"></TextView>
<TextView
android:background="@drawable/cell_shape"
android:id="@+id/MondayTextView"
android:text="@string/MondayString"
android:textStyle="bold"
android:typeface="serif"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_weight="1"/>[...]
I add some text dynamically into cells:
if (x.getTime().equals(time00) || x.getTime().isBefore(time00) && x.getFinnishTime().isAfter(time00)) { daysProgram.add(theDayList.get(0));// The code responsable TextView t = theDayList.get(0);//for finding the appropriate t.setText(x.getTitle()); // cells and filling the with text } if (x.getTime().equals(time01) || x.getTime().isBefore(time01) && x.getFinnishTime().isAfter(time01)) { daysProgram.add(theDayList.get(1)); TextView t = theDayList.get(1); t.setText(x.getTitle()); }[...] The problem is how the table looks after
As you can see, it streches width of some cells, and streches height of others. I want to make the cells to be the same size. All the cells - the populated ones and not populated. I tried to make tableLayout width wrap content - didnt help. I am running out of ideas.
No comments:
Post a Comment