March 2013
Beginner to intermediate
580 pages
16h 11m
English
The steps to creating a UI fragment are the same as those you followed to create an activity:
compose an interface by defining widgets in a layout file
create the class and set its view to be the layout that you defined
wire up the widgets inflated from the layout in code
CrimeFragment’s view will display the information contained within an instance of Crime. Eventually, the Crime class and CrimeFragment’s view will include many interesting pieces, but for this chapter, you just need a text field to contain the crime’s title.
Figure 7.14 shows the layout for CrimeFragment’s view. It consists of a vertical LinearLayout that contains an EditText. EditText is a widget that presents an area where ...
Read now
Unlock full access