public interface IForm {
//寬佔比
int getSpanWidthSize();
//高佔比
int getSpanHeightSize();
//字體對齊
Paint.Align getAlign();
}
複製代碼
而後就是構造二維數組,超級簡單,Form是demo裏面對IForm的實現類。
table = (SmartTable<Form>) findViewById(R.id.table);
Form[][] forms = {
{
new Form("姓名", Paint.Align.LEFT),new Form(),
new Form("性別", Paint.Align.LEFT), new Form(),
new Form("出生日期", Paint.Align.LEFT),new Form(),
new Form("民族", Paint.Align.LEFT), new Form(),
new Form("婚否", Paint.Align.LEFT),new Form(),
new Form(1, 4, "照片")
},
...//這裏省略相同代碼
{
new Form(11, 1, "本人保證如下資料所有屬實,不然本人願意承擔由此形成的一切後果")
},
{
new Form(2, 1, "申請人簽名"), new Form(4, 1, "")
, new Form(2, 1, "日期"), new Form(3, 1, "")
}
};
final FormTableData<Form> tableData = FormTableData.create(table, "登記表", 11, forms);
//將表單數據設置到表格View中去
table.setTableData(tableData);
複製代碼