Android: Simple GridView that displays text in the grids

后端 未结 3 1839
后悔当初
后悔当初 2020-12-06 07:50

I\'m following the example on the android tutorial about the GridView, but instead of showing image, i want to just simple show some text using a TextView. it turns out seem

相关标签:
3条回答
  • 2020-12-06 08:11

    I don't think your getItem implementation is correct. Top of my head it should be

        return texts[position];
    
    0 讨论(0)
  • 2020-12-06 08:16

    I am not sure what could be causing your problem. I followed the step by step instructions on the page that you linked to to set up "Hello, GridView", and used your code and was able to see the text.

    The only things I changed was rather than creating a class for ImageAdapter I used your MyAdapter. In the activity HelloGridView.java onCreate I used "MyAdapter" rather than "ImageAdapter". I didn't change the layout at all.

    Here is a Screenshot of what I get when running your code.

    0 讨论(0)
  • 2020-12-06 08:21

    I see GridView so I'm almost assuming that this is similar to SWT?

    If so you need to show the relationship between your view and the ViewGroup parent

    0 讨论(0)
提交回复
热议问题