I want to convert the text in a string to image and display it in a ImageView
and in addition i want to get the dimensions of the image created at run time for further use. Here is what i have done and used from search.
tv = new TextView(this);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, 60);
tv.setLayoutParams(layoutParams);
tv.setText("Some Text, can be long as much as required");
tv.setTextColor(Color.BLACK);
tv.setBackgroundColor(Color.WHITE);
Bitmap testB;
timer = new Timer();
timer.schedule(new TickerTask(), 1000,25);
testB = Bitmap.createBitmap(600, 20, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(testB);
tv.layout(0, 0, 380, 100);
tv.draw(c);
iv = (ImageView) findViewById(R.id.menuIcon);
iv.setLayoutParams(layoutParams);
iv.setBackgroundColor(Color.GREEN);
iv.setImageBitmap(testB);
Problems: The parameters are not working as set in the code. The complete text is not shown after the image is converted.