How to remove the space between rows of grid view in android

前端 未结 8 1032
猫巷女王i
猫巷女王i 2021-02-02 13:53

In android grid view there is extra space between the rows of grid view. I am not adding any space to the gridview.

here is my xml files

        

        
8条回答
  •  感情败类
    2021-02-02 14:12

    I have another way as a fixing for the same issue while one using RecyclerView.

    Just pass the number of SpanCount like I have given 6 in GridLayoutManager(this, 6) and change the SpanCount to reduce or increase the gap between the items in the RecyclerView.

    Check this sample code-

    GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 6);
      rvSizes.setLayoutManager(gridLayoutManager);
      SizeSelectorAdaptersizeChooserAdapter = new SizeSelectorAdapter(this, sizes);
      rvSizes.setAdapter(sizeChooserAdapter);
    

    Hope this will be useful. Thank you

提交回复
热议问题