【问题标题】:How to place Text on an ImageView inside a GridView?如何在 GridView 内的 ImageView 上放置文本?
【发布时间】:2011-11-05 22:09:26
【问题描述】:

我已经按照这里的教程进行操作:http://developer.android.com/resources/tutorials/views/hello-gridview.html

我想知道如何在此网格视图中的图像上放置文本?我在这里看到过其他示例@stackoverflow,但他们使用linearlayouts,或者他们放弃了,只是为每个人制作了自定义图像,例如here。任何帮助将不胜感激!

【问题讨论】:

    标签: android gridview textview imageview


    【解决方案1】:

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

    所以不要在

    中返回ImageView
    public View getView(int position, View convertView, ViewGroup parent) { ... }
    

    构建类似RelativeLayout 的东西,将 ImageView 和 TextView 添加到其中,然后返回布局。

    【讨论】:

      猜你喜欢
      • 2020-12-20
      • 1970-01-01
      • 2011-08-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多