android+studio四张图片显示
时间: 2023-10-31 14:07:14 浏览: 72
在Android Studio中显示四张图片可以使用ImageView控件。你可以在布局文件中添加四个ImageView,并分别设置它们的src属性来加载图片。以下是一个示例代码:
```xml
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/image1" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/image2" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/image3" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/image4" />
</LinearLayout>
```
请确保将需要显示的图片放置在res/drawable目录下,并将image1、image2、image3和image4替换为实际的图片资源名称。