views:

32

answers:

1

I am working with the sample Home application project on http://developer.android.com/resources/samples/Home/index.html

I've added another value to the THUMBS_IDS and IMAGE_IDS Integer arrays in the Wallpaper class for a total of four wallpaper options.

When I run the application with Device API version 7, Skin: HVGA, hw.lcd.density: 160, in portrait layout, the fourth wallpaper option is not shown.

I need to use the directional keys in the emulator to see the 4th wallpaper option, because the first option is centered.

I have modified only the wallpaper.xml file with a variety of android:layout_* options with no success at this point.

How do I show all four of my wallpaper options?

A: 

The problem isn't so much with the number of thumbnails that can be seen at once, but rather that the spacing between each of the images is so large that the 4th thumbnail is completely off the edge of the screen. So what you really want to do is reduce the spacing between these thumbnails, which are displayed using a Gallery View. Open up the wallpaper.xml file, and this change is very easy to do. Find the line:

android:spacing="16dp"

and replace the 16 with a much smaller number, e.g. 4. (If you're curious, dp stands for density-independent pixel - it's a system Android uses to automatically scale things depending on screen sizes. But this isn't wholly relevant now...) Once that's done, you should see the side of your 4th image in the gallery once you start the program again. Tada!

(Normally galleries should be 'touch-scrollable' as well so you shouldn't have to use the keypad to make it scroll, but I guess they didn't bother implementing that on this example application.)

Steve H
Thank you Steve H., that solved the question I had.
Todd