如何将背景色设置为TextPaint

时间:2019-06-09 00:41:45

标签: java android background-color

我正在使用wuapnjie/StickerView textPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG); realBounds = new Rect(0, 0, getWidth(), getHeight()); textRect = new Rect(0, 0, getWidth(), getHeight()); minTextSizePixels = convertSpToPx(6); maxTextSizePixels = convertSpToPx(32); alignment = Layout.Alignment.ALIGN_CENTER; textPaint.setTextSize(maxTextSizePixels); 添加到我的应用中,因为该库没有向我们提供更改TextSticker的背景色的选项,所以我正在尝试使此方法实现,将颜色设置为TextPaint背景,但是下面的代码不起作用

 @Override
    public void setBackgroundColor(int color) {
        textPaint.bgColor = color;
    }

更改背景颜色方法:

const data = {
  firstname: "John",
  lastname: "Doe6",
  email: "jd6@collabcom.ch"
};


var express = require('express');
var app = express();
var request = require('request');
var bodyParser = require("body-parser");

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.post('/', function (req, res) {
var  data = req.body.user;
console.log(data)
const options = {
  url: 'https://api.starleaf.com/v1/users',
  port: 443,
  method: 'POST',
  headers: {
    'X-SL-AUTH-TOKEN': ''
  },
  json: data
}
request(options, function (error, response, body) {
  if(error){
    console.error("Error: ", error);
  } else if (response.statusCode != 201) {
    console.log("Bad response updating org: " + response.statusCode);
  }  else {
    console.log("Operation successful");
  }
});
});
app.listen(8000, function () {
});

0 个答案:

没有答案