您的位置:首页 > 其它

ImageView 的 Demo

2010-08-16 14:11 274 查看
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);
    }
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: