The Gallery Control

The Gallery control is a horizontally scrollable list control that always focuses at the center of the list. This control generally functions as a photo gallery in touch mode. You can instantiate a Gallery either via XML layout or code:

<Gallery android:id="@+id/galleryCtrl"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

Using the Gallery control is similar to using a list control. That is to say, you get a reference to the gallery, then call the setAdapter() method to populate data, then register for on-selected events.

This concludes our discussion of the Android control set. As we mentioned in the beginning of the chapter, building user interfaces in Android requires you to master two things: the control set and the layout managers. In the next section, we are going to discuss the Android layout managers.

0 0

Post a comment