Laying Out
Most XML screens will be wrapped in a layout object. Layout objects come in many different flavors, each of which you'll look at really quickly and then check out with a simple example in the following sections. Caution At compile time, these XML layout files are parsed and packed by Android into a tight binary format. This saves monstrous amounts of parsing time on startup. However, it means that the XML files cannot be changed by your code during runtime. More specifically, you may be able to...
Scrolling Text Entry Buttons and All the Simple Things in Life
It's now time to put one of the layout classes to use. XML layouts are perfect for user input, information relay, and nearly anything where the contents of the screen are relatively static. You'll add a simple login screen to the aforementioned socially awkward application see Code Listing 3-1 . The first task is to describe what the screen will look like in a new view. You'll use a linear layout so you can just add widgets vertically. Note that this XML requires a general_bg image and the...
Waking Up the Widgets
I've already demonstrated how to use Android's Textview, Button, and EditText widgets. But how useful is a text-entry field if you can't ingest what your users have entered That's a rhetorical question don't answer it I won't be able to hear you I hope . The answer is obvious text entry with no purpose or result is not useful at all. To access the contents of the EditText widgets you defined earlier, you'll have to do two things 1. Get an object handle to the widget you defined in the XML. 2....
