如何更改 Android 示例主页应用程序中显示的缩略图数量?
我正在 http://developer.android 上处理示例 Home 应用程序项目。 com/resources/samples/Home/index.html
我向 Wall 类中的 THUMBS_IDS 和 IMAGE_IDS 整数数组添加了另一个值,总共有四个壁纸选项。
当我使用设备 API 版本 7、皮肤:HVGA、hw.lcd.密度:160、纵向布局运行应用程序时,不显示第四个壁纸选项。
我需要使用模拟器中的方向键来查看第四个壁纸选项,因为第一个选项是居中的。
我仅使用各种 android:layout_* 选项修改了壁纸.xml 文件,但目前没有成功。
如何显示所有四个壁纸选项?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题不在于一次可以看到的缩略图数量,而在于每个图像之间的间距太大,以至于第四个缩略图完全超出了屏幕边缘。因此,您真正想要做的是减少这些缩略图之间的间距,这些缩略图是使用
Gallery
视图显示的。打开wallpaper.xml文件,这个改变很容易做到。找到行:并将 16 替换为更小的数字,例如 4。(如果您好奇,dp 代表与密度无关的像素 - 这是 Android 用于根据屏幕尺寸自动缩放事物的系统。但这不是'现在完全相关...)完成后,再次启动程序后,您应该在图库中看到第四张图像的侧面。田田!
(通常画廊也应该是“可触摸滚动的”,因此您不必使用键盘来使其滚动,但我想他们并没有费心在这个示例应用程序上实现这一点。)
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: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.)