Coder Social home page Coder Social logo

Comments (7)

huangyanbin avatar huangyanbin commented on May 22, 2024

绘制单个 格子背景是
Paint paint = config.getPaint(); paint.setColor(color); paint.setStyle(Paint.Style.FILL); canvas.drawRect(rect, paint);
不是drawColor
你是重写的TextDrawFormat drawBackground方法,其实有专门设置背景的和改变字体颜色的。
table.getConfig().setContentBackgroundFormat(new BaseCellBackgroundFormat() {
@OverRide
public int getBackGroundColor(CellInfo cellInfo) {

            //根据cellInfo.column需要返回不同背景颜色
            return TableConfig.INVALID_COLOR;
        }

        @Override
        public int getTextColor(CellInfo cellInfo) {
            //根据cellInfo.column需要返回不同字体颜色
            return TableConfig.INVALID_COLOR;
        }
    });

from smarttable.

kingyangcn avatar kingyangcn commented on May 22, 2024

@huangyanbin 如果要绘制自定义背景该怎么写呢?

from smarttable.

huangyanbin avatar huangyanbin commented on May 22, 2024

如果你想要绘制圆形或者其他,你可以使用table.getConfig().setContentBackgroundFormat(ICellBackgroundFormat),重新接口方法就可以,可定制自己想要的背景效果,其实BaseCellBackgroundFormat就是个绘制Rect的实现类。

from smarttable.

kingyangcn avatar kingyangcn commented on May 22, 2024

知道了,之前也看到这个方法了,没发现可以通过cell.column得到列的信息,以为只能对所有列统一处理。感谢

from smarttable.

kingyangcn avatar kingyangcn commented on May 22, 2024

@huangyanbin BaseCellBackgroundFormat只有getBackGroundColor,没有getBackGroundDrawable之类的,要怎么实现呢

from smarttable.

huangyanbin avatar huangyanbin commented on May 22, 2024

你想要绘制图片之类的,必须用实现ICellBackgroundFormat接口,然后自己绘制图片,绘制图片很简单,网上一大堆。

from smarttable.

kingyangcn avatar kingyangcn commented on May 22, 2024

好的。真是太感谢了

from smarttable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.