• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Jiayu Shao
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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?



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic