android中水平ScrollView上的TextView?
你能告诉我,当我们在 GalleryView
中选择一个项目时,它会出现在屏幕中央,如何限制它?我只想在点击该项目的地方。如何?简单地说,我想要水平列表视图。如何?
谢谢
Can you tell me when we select an item in GalleryView
its comes to the center of the screen how to restrict it? I want to just be there where i click that item. How? Simple words, I wanna horizontal Listview. How?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你好,
我建议您检查“你好,画廊”谷歌文档,说得很清楚。正如他们所说,画廊的设计目的是“在水平滚动列表中显示项目,并将当前选择锁定在中心”。
只需要将ImageAdapter替换为TextAdapter,并将TextView放入其中而不是ImageView即可。它实际上的工作方式与列表视图完全相同。所以你知道如何做一个列表视图,这应该很容易。
编辑
这是我认为一个不错的解决方案:
您需要更改 画廊风格。默认情况下,它的定义如下:
因此,您需要在文件夹库中创建自己的 styles.xml 并将其放入其中:
这给了我这个:
替代文本 http://img249.imageshack.us/img249/1893/testgallery.png< /a>
现在我确信我们可以通过使用画廊和风格的各种属性来获得更好的结果,但我认为这对您来说是一个很好的引导;)
HI,
I would advise you check the "Hello, Gallery" on the google doc, it is very clear. Gallery is design to "display items in a horizontally scrolling list that locks the current selection at the center", as they say.
You just need to replace the ImageAdapter by TextAdapter, and put TextViews in it instead of ImageViews. It actually work exactly like a Listview. so you know how to do a Listview, this should be easy.
EDIT
Here is I think a nice solution :
You need to change the style of the gallery. As default it is defined like that :
So you need to create your own styles.xml in your folder gallery and put that in it :
This gives me this :
alt text http://img249.imageshack.us/img249/1893/testgallery.png
Now I'm sure we can get better result by playing with the various attributes of the gallery and the style, but I think this is a good lead for you ;)