How to cenralize last uneven row in GridView in android?

后端 未结 4 1947
北海茫月
北海茫月 2020-12-11 03:03

I have a GridView , which displays pictures of alphabets what happens is , every time in the last row there are less no of alphabets. and the last row is left a

4条回答
  •  Happy的楠姐
    2020-12-11 03:51

    You could center the grid row inside of a relative layout and then add android:layout_centerHorizontal="true" to the alphabet ImageView's. Assuming that they're ImageView's.

    So your GridView would be wrapped in something like this:

    
    
          
    
        
    
    

    And the individual alphabet images would need android:layout_centerHorizontal="true" like this:

    
    

提交回复
热议问题