Android Wear(Long Textview) -


hi guys drawing text using canvas, , need change textview everyhour, if textview extends width should displayed in next line example , have text "good morning" , "good morning rachel ! welcome you"

the first textview morning correctly displayed in single line second textview need print 2 line how can draw

string mytext = "hi how how day "   canvas.drawtext(mytext , x, centerx, mtextpaint); 

scale = resources.getdisplaymetrics().density;          textpaint textpaint=new textpaint();         textpaint.setargb(255, 255, 255, 255);         textpaint.settextsize(28f);         textpaint.settypeface(myfonttime);         staticlayout mtextlayout;         mtextlayout = new staticlayout(mytext, textpaint, canvas.getwidth(), layout.alignment.align_normal, 1.0f, 0.0f, false);          int textheight = mtextlayout.getheight()- (int) (16 * scale +5.0);         int textwidth = canvas.getwidth() - (int) (16 * scale);         float x = cwidth / 2f - textwidth/2f  - bounds.left;         float y = cheight / 2f - textheight/2f;          canvas.save();         canvas.translate(x, y);         mtextlayout.draw(canvas);         canvas.restore(); 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -