On a blog How to create a new Android project and run a built after the HelloWorld program, do you crossing think learning Android is not very difficult.
This blog mainly explains the use of wirelessly text tags
TextView components
We can look at the Android API first
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5A/12/wKiom1T1VKPgeqxrAAIug7bhC5k840.jpg "title=" 1.png " alt= "Wkiom1t1vkpgeqxraaiug7bhc5k840.jpg"/> by We can know TextView static text display of the component, and we can make certain edits to the text.
TextView inandroid.widget bag ( The specific view components we use in Aandroid are in the Android.widget package, and android.widget.textview is Android.view.View Direct sub-class note here that the TextView class is not in the Android.view package.
> Next we can follow the steps in my previous chapter blog (Android Case-the first app)
Select activity_main.xml Double-click on the layout directory under Ex_01, res, and then generate a label on the right-hand view screen, select the Body activity_main.xml label, as
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/5A/12/wKiom1T1WPrRdlJrAATIHy8P5Js092.jpg "title=" 1.png " alt= "Wkiom1t1wprrdljraatihy8p5js092.jpg"/>
modifying XML code
<textview android:layout_width= "wrap_content" android:layout_height= "wrap_content" android:text= "@ String/hello_world "/>
After modification
<textview android:id= "@+id/tv" android:layout_width= "wrap_content" android:layout_height= "Wrap_con Tent "android:text=" My first TextView "/>
Save
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/5A/12/wKiom1T1XYqQkKYRAAJa0xpykXQ865.jpg "title=" 1.png " alt= "Wkiom1t1xyqqkkyraaja0xpykxq865.jpg"/>
Save and run and we'll see the modified text.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/5A/0E/wKioL1T1XQrjQDamAADFt57u7t0776.jpg "title=" 1.png "alt=" wkiol1t1xqrjqdamaadft57u7t0776.jpg "/>
We can also modify the text in the Java code
@Override protected void oncreate (bundle savedinstancestate) { super.oncreate (savedInstanceState); setcontentview (R.layout.activity_main); //find the id of the control TextView tv = (TextView) findviewbyid (r.id.tv); //Generate Text String str = " TextView can be modified not only in the XML file, but in the Java code as well! "; // Put the generated text into the corresponding ID of the TextView tv.settext (str); }
Save 650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5A/0E/wKioL1T1XtqzwqNLAAGZAE_NmVI757.jpg "title=" 1. PNG "alt=" wkiol1t1xtqzwqnlaagzae_nmvi757.jpg "/>
Save and run
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/5A/0E/wKioL1T1Xzuw0LLwAADU47bka9M869.jpg "title=" 1.png " alt= "Wkiol1t1xzuw0llwaadu47bka9m869.jpg"/>
Project Instance code address http://down.51cto.com/data/1985640
This article is from the "8949313" blog, please be sure to keep this source http://8959313.blog.51cto.com/8949313/1616863
Android actual case--textview use