Finding TextView objects using the Findviewbyid function in the OnCreate method
mTextView01 = (TextView) Findviewbyid (r.id. MYTEXTVIEW01);
String str_2 = "Welcome Android ' s World";
Mtextview01.settext (str_2); The text value of the Str_2 value passed to the defined Textview,textview is set to Str_2
Note The TextView object needs to be described first
Import Android.widget.textview;
Then explain it in the activity
Private TextView mtextview01;
The TextView SetText supports the following polymorphic constructs:
Public final void SetText (charsequence text)
Publice final void settext (int resid)
Publice viod settext (charsequence text,textview.buffertype type)
Publice final void settext (int resid,textview.buffertype type)
Publice final Viod settext (char[] text, int start, int len)
Example: char char_1[] = new CHAR[5];
Char_1[0] = ' a ';
Char_1[1] = ' B ';
CHAR_1[2] = ' C ';
CHAR_1[3] = ' d ';
CHAR_1[4] = ' e ';
Mtextview01.settext (char_1,1,3;)
Output as "BCD"
Conversion of HTML tags
<TextViewxmlnsAndroid="Http://schemas.android.com/apk/res/android"
Android: layout_width="Wrap_content"
android: layout_height="Wrap_content"
android: autolink="All"
android: text="Please button:http//www.baidu.com"/>
Error: You must supply a layout_width attribute
This error occurs because the attribute in the XML file is undefined;
SetText method Output string variable of type string