Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

没有数据时设置无数据样式 #278

Open
yebin254126 opened this issue Aug 2, 2021 · 1 comment
Open

没有数据时设置无数据样式 #278

yebin254126 opened this issue Aug 2, 2021 · 1 comment

Comments

@yebin254126
Copy link

我在drawContent中添加一下代码:

    if (columns.size() == 0 || columns.get(0).getDatas().size() == 0) {
        Paint paint = config.getPaint();
        Rect rect = new Rect(showRect.left, showRect.top, showRect.right, showRect.bottom + 200);
        DrawUtils.drawSingleText(canvas, paint, rect, "无数据");
    }

用来设置无数据时的样式,但没有绘制出来

@dylanZk1
Copy link

因为这里的rect是相对表格区域的,没有数据的话连表格区域都没有,这里的rect当然就是null了,在null的区域绘制文本当然不会显示了。这个时候你需要自定义一个rect,设置区域范围后在这个范围内渲染文本才行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants