diff --git a/app/src/main/java/com/bin/david/smarttable/MultParseModeActivity.java b/app/src/main/java/com/bin/david/smarttable/MultParseModeActivity.java index ac1be28..641962b 100644 --- a/app/src/main/java/com/bin/david/smarttable/MultParseModeActivity.java +++ b/app/src/main/java/com/bin/david/smarttable/MultParseModeActivity.java @@ -110,7 +110,7 @@ public void onResourceReady(Bitmap bitmap, Transition transition } }); avatarColumn.setFixed(true); - Column < String > column4 = new Column<>("测试多重查询", "childData.child"); + Column < String > column4 = new Column<>("测试多重查询", "childData.child",new MultiLineDrawFormat(this,100)); column4.setAutoCount(true); final IFormat format = new IFormat() { @Override diff --git a/form/src/main/java/com/bin/david/form/data/format/draw/MultiLineDrawFormat.java b/form/src/main/java/com/bin/david/form/data/format/draw/MultiLineDrawFormat.java index 8d8ae0a..4f41c8f 100644 --- a/form/src/main/java/com/bin/david/form/data/format/draw/MultiLineDrawFormat.java +++ b/form/src/main/java/com/bin/david/form/data/format/draw/MultiLineDrawFormat.java @@ -62,11 +62,10 @@ public void draw(Canvas c, Rect rect, CellInfo cellInfo ,TableConfig config) textPaint.setTextAlign(cellInfo.column.getTextAlign()); } int hPadding = (int) (config.getHorizontalPadding()*config.getZoom()); - int vPadding = (int) (config.getVerticalPadding()*config.getZoom()); int realWidth =rect.width() - 2*hPadding; StaticLayout staticLayout = new StaticLayout(cellInfo.column.format(cellInfo.row), textPaint, realWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); c.save(); - c.translate(DrawUtils.getTextCenterX(rect.left+hPadding,rect.right-hPadding,textPaint), rect.top+vPadding); + c.translate(DrawUtils.getTextCenterX(rect.left+hPadding,rect.right-hPadding,textPaint), rect.top+(rect.height()-staticLayout.getHeight())/2); staticLayout.draw(c); c.restore(); }