public class MainActivity extends AppCompatActivity { private SmartTable<String> table; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); table = findViewById(R.id.table); String[] week = {"日", "一", "二", "三", "四", "五", "六"}; String[][] strings = {{"日", "一", "二", "三", "四", "五", "六"}, {"日", "一", "二", "三", "四", "五", "六"}, {"日", "一", "二", "三", "四", "五", "六"}}; ArrayTableData<String> data = ArrayTableData.create("日程表", week, ArrayTableData.transformColumnArray(strings), new IDrawFormat<String>() { @Override public int measureWidth(Column<String> column, int position, TableConfig config) { return 100; } @Override public int measureHeight(Column<String> column, int position, TableConfig config) { return 100; } @Override public void draw(Canvas c, Rect rect, CellInfo<String> cellInfo, TableConfig config) { Paint paint = config.getPaint(); paint.setTypeface(Typeface.DEFAULT_BOLD); paint.setStyle(Paint.Style.FILL); paint.setColor(Color.parseColor("#000000")); c.drawText(cellInfo.value, rect.centerX(), rect.centerY()+10, paint); } }); table.getConfig().setColumnTitleBackground(new IBackgroundFormat() { @Override public void drawBackground(Canvas canvas, Rect rect, Paint paint) { canvas.drawColor(Color.parseColor("#999999")); } }); table.getConfig().setContentBackground(new IBackgroundFormat() { @Override public void drawBackground(Canvas canvas, Rect rect, Paint paint) { canvas.drawColor(Color.parseColor("#ffffff")); } }); table.setTableData(data); } }