fill the screen with the table rows and cols
This commit is contained in:
parent
024357ec48
commit
6e4d4a4f7e
|
@ -5,6 +5,7 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import android.view.LayoutInflater;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TableRow;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
|
@ -15,7 +16,16 @@ public class MainActivity extends AppCompatActivity {
|
|||
|
||||
TableLayout tableHolder = (TableLayout) findViewById(R.id.table_holder);
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
TableRow row = (TableRow) inflater.inflate(R.layout.table_row, tableHolder, false);
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
final TableRow row = (TableRow) inflater.inflate(R.layout.table_row, tableHolder, false);
|
||||
for (int j = 1; j < 8; j++) {
|
||||
final TextView day = (TextView) inflater.inflate(R.layout.table_day, row, false);
|
||||
day.setText("" + (i * 7 + j));
|
||||
row.addView(day);
|
||||
}
|
||||
|
||||
tableHolder.addView(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView
|
||||
android:id="@+id/day"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"/>
|
|
@ -4,62 +4,7 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/col1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/col2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="2"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/col3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="3"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/col4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="4"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/col5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="5"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/col6"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="6"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/col7"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="7"/>
|
||||
|
||||
</TableRow>
|
||||
|
|
Loading…
Reference in New Issue