• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to set gravity to center of textview in Android gridview?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a gridview of textview and checkbox in an android project. When I add setGravity(Gravity.Center) in adapter class, the result prints the first data in second row. It should output in the first row. The row number is exactly the same as rows of data in txt file. Below is my code. When I call onItemClick in Activity class with getItemAtPosition method, the item on clicked items are correct. If you see the picture below, even though the first row of textviews show nothing getItemAtPosition method does read my first row of my txt file(which is also the next row in the picture below).
Could someone tells me why this is happening and how to solve this issue?



 
Don't play dumb with me! But you can try this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic