如何在GridView内的ImageView上放置Text?

时间:2011-11-05 22:09:27

标签: android gridview textview imageview

我已按照此处的教程:http://developer.android.com/resources/tutorials/views/hello-gridview.html

我想知道如何在此gridview中的图像上放置文本?我在这里看到了其他的例子@ stackoverflow,但它们与linearlayouts一致,或者他们放弃了,只为here之类的每个人制作了自定义图像。任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:1)

我不确定这是否是最好的方法,但我会尝试返回一个布局(这是View的间接子类),它封装了包含图像的ImageView和{ {1}}带有重叠文字。

所以不要在

中返回TextView
ImageView

构建类似public View getView(int position, View convertView, ViewGroup parent) { ... } 的东西,将ImageView和TextView添加到其中,然后返回布局。

相关问题