嗨,我并排有 4 个图像,我正在尝试增加 ImageView 之间的间距...但 itz 不起作用..尝试了 java 中的 setSpacing(int)...android:xml 布局中的间距
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:orientation="horizontal" >
<ImageView
android:id="@+id/navigationImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="15dp"
android:spacing="15dp" />
<ImageView
android:id="@+id/streetViewImage"
android:src="@drawable/streetview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="15dp"
android:spacing="15dp" />
<ImageView
android:id="@+id/phoneImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="20dp"
android:paddingRight="15dp"
android:spacing="15dp" />
</LinearLayout>
这是我的java代码
ImageView Image = (ImageView) view.findViewById(R.id.navImage);
Image.setImageResource(R.drawable.navigation);
Image.setSpacing(5);
感谢任何帮助
最佳答案
您应该了解padding
和margin
之间的区别:
关于java - Android: ImageView 之间的间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13303408/