-
Once again, here's the design
we're looking to create.
-
What's great about this view is that
it uses mostly UI elements we've seen
-
before.
-
In order to prevent the number
of complex layouts from growing
-
explosively, we're going to
take advantage of three Android
-
layout features.
-
The first one we've seen before.
-
The only difference between
a forecast list item on the phone and
-
on the tablet is padding and
margins around the list items.
-
Fortunately, it's easy to add
this to the forecast list.
-
We can use dimensions to give the same
layout more space in tablet layouts.
-
In forecast list item layout, we can add
a padding dimension to the outer layout.
-
We use padding here instead of margin
because we just want the content in set.
-
If we used margin,
-
the row selector wouldn't be drawn
across the entire list item.
-
We also use a different dimension for
the space between the two temperatures.
-
Note that we use both right and
-
end to make sure that this layout is
ready for right to left mirroring.
-
So then in our resource's file we
create a dimension that updates
-
the extra padding and
the space between the two temperatures.
-
And that layout is updated.
-
I'm using sw600dp-port.
-
Which means that these changes will
only be applied Portrait Orientation
-
with devices and a view sides
with at least a width of 600 dp.
-
The second thing we take advantage of
is Layout Reuse using the include tag.
-
We can see that our portrait and
-
landscape detail fragment
use the same views.
-
The fragment detail view contains
these included lay outs already.
-
Note that we can assign new lay out
parameters when we include the lay out.
-
We're not using this in sunshine.
-
But we can avoid adding an extra
container when we include the layout by
-
using the merge tag in
the layout to be included.
-
Finally, we're going to
continue to make use of Refs.
-
Refs allow us to make aliases for
resources.
-
As you can see,
in tablet landscape mode,
-
the detail view should point to
a vertical version of the view.
-
We're going to create a Ref that
points to fragment_detail_start and
-
make sure that it points to the correct
detail fragment for all configurations.
-
This will come in handy
in the next lecture.