Android Programming Tutorials

(Romina) #1
A Few Good Resources

If you rebuild and reinstall the application, then run it in landscape mode,


you will see a form that looks like this:


Figure 21. The LunchList in landscape orientation, revised

Note that we did not create a LunchList/res/layout-land/ edition of our row


layout (row.xml). Android, upon not finding one in LunchList/res/layout-


land/, will fall back to the one in LunchList/res/layout/. Since we do not


really need our row to change, we can leave it as-is.


Note that when you change the screen orientation, your existing


restaurants will vanish. That is because we are not persisting them


anywhere, and rotating the screen by default destroys and recreates the


activity. These issues will be addressed in later tutorials.


Extra Credit..................................................................................................


Here are some things you can try beyond those step-by-step instructions:



  • Find some other icons to use and create a LunchList/res/drawable-


land directory with the replacement icons, using the same names as
found in LunchList/res/drawable. See if exposing the keyboard

swaps the icons as well as the layouts.



  • Change the text of the labels in our main layout file to be string


resources. You will need to add those values to
LunchList/res/values/strings.xml and reference them in

LunchList/res/layout/main.xml.


91
Free download pdf