How to set size of MARGINS in GridLayout
问题 I am adding ImageButtons one at a time to a GridLayout using RecyclerView. My app listens for incoming images and strings to label the buttons. I want to add a margin to the right of each button and text, so the words don't run into each other (like my image below). 回答1: No, these are not the sort of things an adapter is for. Set margin or padding (you probably want padding) inside your XML layout file. You can set android:paddingRight or android:paddingEnd in the XML declaration of the view.