Time for action - building the Photos tab
Before we can add images to a
Gallery, we need the
Gallery object on the screen. To start this exercise, we'll add a
Gallery object and an
FrameLayout of our tabs. This will appear under the Photos tab that we created at the beginning of the chapter. We'll stick to a fairly traditional photo gallery model of the sliding thumbnails at the top of the screen, with the full view of the selected image below it.
res/layout/main.xmlin your editor or IDE.
- Inside the second
android:id="@+id/photos", add a new
Galleryelement to hold the thumbnails:
<Gallery android:id="@+id/gallery" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
Galleryobjects, by ...