This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Kubernetes in Action and have Marko Luksa on-line!
See this thread for details.
Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
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?



 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!