Hello, I have a bunch of text on my file that I show. I used the Hello World demo to include this lesson. Now it does not happen whenever I try to edit main.xml. If someone knows why it will be good, but I want to know how to put a simple scroll in my text. I do not think I need to use main .xml, is there any way I can add it to my project?
Import android.app.activity; Importroid.os.Bundle; Import android.widget.TextView; The public class declaration expands the activity {/ ** is called when the activity has been created first. * / @ Override Crate on Public Zero (Bundle Saved Instantstate) {Super. Contents (Saved Instantstate); SetContentView (R.layout.main); // Activation Object TextView TV = Create a new text view passing new textview (this); // Set a text in the view TV. Set text ("A bunch of text."); Tv.setTextSize (12); // Set the scene in the Activity View Container setContentView (TV); }}
Here is the XML file that you want to see.
& lt ;? Xml version = "1.0" encoding = "UTF-8" & gt; & Lt; LinearLayout Android: id = "@ + id / linearLayout01" Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" xmlns: android = "http://schemas.android.com/apk/res/android" & gt; & Lt; TextView android: text = "@ + id / textView01" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: id = "@ string / hello" & gt; & Lt; / TextView & gt; & Lt; / LinearLayout & gt; First, you are calling setContentView (tv)
, so you are not actually seeing any view
from XML, only you got started in onCreate
() in TextView
is. Also, it seems that you have mixed your android: text
and android: id
attributes in your XML Android: layout_width = "wrap_content" Android: layout_height = "Wrap_content" Android: text = "@ string / hello" Android: Android: id = "@ + id / textView01" should be "/ & gt;
And for your question on scrolling, see.
Comments
Post a Comment