Android Programming Tutorials

(Romina) #1
Turn, Turn, Turn

android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Save"
/>
</LinearLayout>
</TableRow>
</TableLayout>

Now, if you recompile and reinstall the application, you should see a better


landscape rendition of the detail form:


Figure 31. The new landscape layout

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


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



  • Try switching to onRetainNonConfigurationInstance() instead of
    onSaveInstanceState().

  • Try commenting out onSaveInstanceState(). Does the activity still


retain its instance state? Why or why not?



  • Have the application automatically rotate based on physical


orientation instead of keyboard position. Hint: find a place to apply
android:screenOrientation = "sensor".

150
Free download pdf