增加Android的发车间隔间隔、Android

2023-09-05 01:53:26 作者:智商欠费不死也废

我有一个GridView中,我有很多的项目在三个colums。我想增加它们之间的间距。我怎样才能做到这一点在Android的?

I have a gridview in which i have a lot of items in three colums. I want to increase the spacing between them. How can I do that in android?

推荐答案

您可以使用 安卓verticalSpacing 机器人:horizo​​ntalSpacing 在GridView的标签,并提供了间距按照您的要求

You can use android:verticalSpacing and android:horizontalSpacing in GridView tag and provide the spacing as per your requirement.

例如:

  <GridView
        android:layout_height="wrap_content"
        android:id="@+id/gridView1"
        android:layout_width="match_parent"
        android:numColumns="auto_fit"
        android:horizontalSpacing="10dp"       // space between two items (horizontal)
        android:verticalSpacing="10dp">        // space between two rows (vertical)
  </GridView>
 
精彩推荐
图片推荐