How to support `layout_columnWeight` and `layout_rowWeight` in pre API 21?

后端 未结 3 1471
一生所求
一生所求 2020-12-11 14:55

I use the below grid layout with layout_columnWeight and layout_rowWeight to centralize my view in the grid cell.



        
3条回答
  •  遥遥无期
    2020-12-11 15:22

    the version of GridLayout in support library is backward compatible and supports weights as mentioned here:

    https://developer.android.com/reference/android/support/v7/widget/GridLayout.html

    so you just need to add compile 'com.android.support:gridlayout-v7:23.1.1' to your build.gradle file and use support gridlayout instead ;)

    use it like below (android.support.v7.widget.GridLayout) in your layout xml file:

    
    
        
    
    

提交回复
热议问题