imageview.xml
代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!--
ImageView - 图片显示控件
-->
<ImageView android:id="@+id/imageView" android:layout_width="wrap_content"
android:layout_height="wrap_content"></ImageView>
</LinearLayout>
_ImageView.java
代码
package com.webabcd.view;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageView;
public class _ImageView extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.setContentView(R.layout.imageview);
setTitle("ImageView");
ImageView imgView = (ImageView) this.findViewById(R.id.imageView);
// 指定需要显示的图片
imgView.setBackgroundResource(R.drawable.icon01);
}
}