Gridview not fit for all screens in Android

后端 未结 2 655
迷失自我
迷失自我 2020-12-22 13:14

I am working in an Android app. In this I have an issue that my GridView and images are not get fit with all screen sizes .

Here I have the grid

2条回答
  •  梦毁少年i
    2020-12-22 13:30

    Use GridLayout to acquire the desired result.Firstly add gridLayout dependancy:

    compile 'com.android.support:gridlayout-v7:27.0.1'
    

    Then, add the following xml code:

     
    
        
    
            
    
                
    
                
            
    
         
    
      
    

    In the above code, I've just added 1 element. Just copy & paste this FrameLayout and change texts & images accordingly. After adding 12 elements, the output should look as below:

提交回复
热议问题