是否可以將EditText
框中的字符串文本轉換爲位圖?換句話說,是否有任何方法將字符串文本轉換爲位圖,這意味着文本將顯示爲圖像?將字符串文本轉換爲位圖
下面是我的代碼:
class TextToImage extends Activity {
protected void onCreate(Bundle savedInstanceState) {
//create String object to be converted to image
String sampleText = "SAMPLE TEXT";
String fileName = "Image";
//create a File Object
File newFile = new File("./" + fileName + ".jpeg");
//create the font you wish to use
Font font = new Font("Tahoma", Font.PLAIN, 11);
//create the FontRenderContext object which helps us to measure the text
FontRenderContext frc = new FontRenderContext(null, true, true);
}
}
泰德·霍普爲我讀了互聯網AWT在Android操作系統不支持... – shyam 2012-01-10 06:23:26
@shyam - 這是所有的Android類,而不是AWT類。他們在'android.graphics'包 – 2012-01-10 06:25:25
嘿特德霍普我使用canvas.drawText()在畫布上繪製文本現在我想移動它的文本接觸意味着移動手指上的文本運動..我有代碼移動圖像在畫布的表面..如果可以將文本作爲圖像,然後我可以將它用作圖像並在屏幕上移動文本..所以,如何將文本轉換爲BitMap以將其移動到屏幕上? – shyam 2012-01-10 06:49:32