在Android框架中编辑文本

在Android框架中编辑文本

本文介绍了在Android框架中编辑文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使其变为粗体"并更改颜色?有人可以帮助我吗?我尝试了很多次,但仍然无法正常工作.

 Core.putText(mRgba, "Result : " +
            	contours.size(), new org.opencv.core.Point(0, 300),
            	Core.FONT_HERSHEY_SIMPLEX, 2.6f, new Scalar(255, 255, 0))          

解决方案

阅读文档:两者都有参数.

public static void putText(Mat img,
    java.lang.String text,
    Point org,
    int fontFace,
    double fontScale,
    Scalar color,
    int thickness)

然后:

Core.putText(mRgba, 
    "Result : " + contours.size(),         
    new org.opencv.core.Point(0, 300),    
    Core.FONT_HERSHEY_SIMPLEX,         
    2.6f,                             
    new Scalar(255, 255, 0), // color in BGR format, you should change this one
    2 // thickness (can be used to achieve bold)
) 

How to make it "Bold" and change color ? somebody can help me ? I try many times but still not working.

Core.putText(mRgba, "Result : " +
            	contours.size(), new org.opencv.core.Point(0, 300),
            	Core.FONT_HERSHEY_SIMPLEX, 2.6f, new Scalar(255, 255, 0))         

解决方案

Read the documentation: you have parameters for both of them.

public static void putText(Mat img,
    java.lang.String text,
    Point org,
    int fontFace,
    double fontScale,
    Scalar color,
    int thickness)

Then:

Core.putText(mRgba, 
    "Result : " + contours.size(),         
    new org.opencv.core.Point(0, 300),    
    Core.FONT_HERSHEY_SIMPLEX,         
    2.6f,                             
    new Scalar(255, 255, 0), // color in BGR format, you should change this one
    2 // thickness (can be used to achieve bold)
) 

这篇关于在Android框架中编辑文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 13:10