package com.test.helloworld;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageView;
public class helloworld extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ImageView i = new ImageView(this);
i.setImageResource(R.drawable.image_name);
setContentView(i);
}
}
这是一个简单的应用程序,它显示res / drawable文件夹中的特定图像(image_name)。
由于我无法多次使用setContentView()
,如何在同一视图中显示多个图像? (所有图像都保存在可绘制文件夹中)
答案 0 :(得分:0)
创建多个图像视图并使用网格布局。
如果要显示应在滑动或按钮单击时更改的全尺寸图像,请尝试使用片段和帧布局。