編輯:Android編程入門
ImageView
1.什麼是ImageView
是顯示圖片的一個控件
2.ImageView屬性
android:src ImageView的內容顏色
android:background ImageView背景圖片
android:color ImageView的RGB顏色
項目裡我新建了一個Icon,名為ic_lena。
這個項目用於演示ImageView的src屬性和bakground的區別。
src和background屬性可以同時存在。
ImageView部分的代碼片段:
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/ic_lena"
android:background="#00FFFF"
/>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/ic_lena"
android:background="#00FFFF"
/>
<ImageView
android:id="@+id/imageView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_lena" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="#00FFFF" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="200dp"
android:layout_height="200dp"
android:background="@drawable/ic_lena" />
</LinearLayout>
fragment_main.xml
不同分辨率下圖片的顯示:
ic_lena圖片:

效果:

Android學習筆記:ActionBar使用介紹
一、基本概念最權威和官方的介紹請看google的api文檔http://developer.android.com/training/basics/actionbar/s
寫一個Android輸入法01——最簡步驟
下一篇本文演示用Android Studio寫一個最簡單的輸入法。界面和交互都很簡陋,只為剔肉留骨,彰顯寫一個Android輸入法的要點。1、打開Android Stud
【入門篇】Android學習筆記——項目結構及相關基礎知識
Android項目具有其自身的結構規范,完好的遵循結構規范,可以讓開發事半功倍。下圖分別從Android視圖和Project視圖展示了Android項目的項目結構:圖中左
android中的所謂觀察者模式
生活中我們常認定某些人很有才,但什麼是有才呢?明朝的王守仁曾這樣解釋:才,是所謂天理,應用到物上,便成了才。凡事凡物,只要