Android控件之ImageView(显示图片的控件)

一、ImageView属性:

  android:src = "@drawable/ic_launcher"——ImageView的内容图像(可以和android:background = "#00000"同时使用)

  android:background = "@drawable/ic_launcher"——ImageView的背景图像

  android:background = "#00000"——ImageView的RGB颜色

 

 

 

二、布局文件中设置ImageView控件

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#f0f0f0"
        android:src="@drawable/ic_launcher" />
    
    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/ic_launcher" />
    
    <ImageView
        android:id="@+id/imageView3"
        android:layout_width="match_parent"
        android:layout_height="20dp"
        android:background="#f0f0f0" />

</LinearLayout>

posted @ 2015-07-19 22:23  胡椒粉hjf  阅读(734)  评论(0编辑  收藏  举报