TextView is a control used to display text labels.
Copy codeThe Code is as follows:/* TextView settings * // * Get the TextView object */
Textview = (TextView) this. findViewById (R. id. textview );
String string = "TextView example! ";
/* Set the text color */
Textview. setTextColor (Color. RED );
/* Set the font size */
Textview. setTextSize (20 );
/* Set the text background */
Textview. setBackgroundColor (Color. BLUE );
/* Set the text displayed in TextView */
Textview. setText (string );
Copy codeThe Code is as follows:/* TextView shows the webpage */textView1 = (TextView) this. findViewById (R. id. textview1 );
TextView2 = (TextView) this. findViewById (R. id. textview2 );
// Add an html flag
String html = "<font color = 'red'> I love android </font> <br> ";
Html + = "<font color = '# 0000ff'> <big> <I> I love android </I> </big> </font> <p> ";
Html + = "<big> <a href = 'HTTP: // www.jb51.net '> script home </a> </big> ";
CharSequence charSequence = Html. fromHtml (html );
TextView1.setText (charSequence );
TextView1.setMovementMethod (LinkMovementMethod. getInstance (); // a hyperlink is generated when you click
String text = "My URL: http://www.jb51.net \ n ";
Text + = "my email: ****** @ gmail.com \ n ";
Text + = "My Phone: + 86 137 ********";
TextView2.setText (text );
TextView2.setMovementMethod (LinkMovementMethod. getInstance ());