Android控件开发之ImageView

ImageView以最简单的方式显示图片,这也是布局中使用图片最常用的方式,可以让您的程序变的生动活泼

ImaeView效果图


本程序main.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">
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"/>
<ImageView 
    android:id="@+id/imageview"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/bg" 
    android:layout_gravity="center_vertical"/>

</LinearLayout>




本程序java源码

package com.sx.ImageView;


import android.app.Activity;
import android.os.Bundle;


public class ImageViewActivity extends Activity 
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章