WEB开发网
开发学院手机开发Android 开发 Android BlackBerry 文本对齐方式对比 阅读

Android BlackBerry 文本对齐方式对比

 2010-02-23 00:44:00 来源:WEB开发网   
核心提示:canvas.drawText("this is demo", imageWidth, 49, p);这句话则说明居右对齐的点在imageWidth的位置,这都是相对的概念,Android BlackBerry 文本对齐方式对比(2),下面是BlackBerry的代码:Java代码Bitmap bi

canvas.drawText("this is demo", imageWidth, 49, p);

这句话则说明居右对齐的点在imageWidth的位置,这都是相对的概念。

下面是BlackBerry的代码:

Java代码

Bitmap bitmap = new Bitmap(imageWidth, imageHeight);

Graphics graphics = Graphics.create(bitmap);

graphics.drawText("This is the demo", 0, 0, Graphics.HCENTER,

Display.getWidth());

Bitmap bitmap = new Bitmap(imageWidth, imageHeight);

Graphics graphics = Graphics.create(bitmap);

graphics.drawText("This is the demo", 0, 0, Graphics.HCENTER,

Display.getWidth());

graphics.drawText("This is the demo", 0, 0, Graphics.HCENTER,

Display.getWidth());

这段代码是说让文本居中对齐 Graphics.HCENTER,那么Display.getWidth()就是所画的区域宽度。

另外BlackBerry的对齐方式还能进行组合使用,比如:

Java代码

graphics.drawText("This is the demo", 0, 0, Graphics.HCENTER|Graphics.VFULL,

Display.getWidth());

graphics.drawText("This is the demo", 0, 0, Graphics.HCENTER|Graphics.VFULL,

Display.getWidth());

所以Android和BB在文本对齐的方式上有很大的不同。

上一页  1 2 

Tags:Android BlackBerry 文本

编辑录入:coldstar [复制链接] [打 印]
赞助商链接