【问题标题】:How to call the string value in canvas?如何在画布中调用字符串值?
【发布时间】:2012-11-08 01:21:24
【问题描述】:

我在 String 中有一些存储值,例如:

Intent myIntent = getIntent(); 
Bundle b = myIntent.getExtras();
String a = b.getString("a");

我想在我的画布页面上显示这个值:如何显示它?我试过这样做:

canvas.drawText(a,apaint);

但它不起作用。你能帮帮我吗..

【问题讨论】:

  • 什么不起作用?当您尝试上述代码时发生了什么?你有编译器错误吗?应用程序运行了吗?如果是,发生了什么?

标签: android android-layout android-intent android-emulator android-canvas


【解决方案1】:

先设置油漆颜色

paint.setColor(Color.WHITE);

然后绘制文字

canvas.drawText(a, x, y, paint);

x 和 y - 原点坐标。

【讨论】:

    猜你喜欢
    • 2015-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-23
    • 2017-05-28
    • 2013-11-12
    • 1970-01-01
    • 2013-02-17
    相关资源
    最近更新 更多