編輯:Android開發教程
Gallery可以顯示一系列的圖片,並且可以橫向滑動。下面展示如何使用Gallery去顯示一系列的圖片。
1. 創建一個工程,Gallery。
2. main.xml中的代碼。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Images of San Francisco" />
<Gallery
android:id="@+id/gallery1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/image1"
android:layout_width="320dp"
android:layout_height="250dp"
android:scaleType="fitXY" />
</LinearLayout>
3. 在res/values文件夾下面新建一個文件,attrs.xml。
4. attrs.xml中的代碼。
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="Gallery1">
<attr name="android:galleryItemBackground" />
</declare-styleable>
</resources>
5. 准備一些圖片。將這些圖片放在res/drawable-mdpi下面。

Android簡明開發教程四:Android應用基本概念
Android平台的一個顯著的特點是“低耦合”。Activity是Android應用的一個最基本的用戶UI模塊。如果采用Windows Form
Android 系統中 Location Service 的實現與架構
前言定位服務是移動設備上最常用的功能之一,下文以 Android 源碼為基礎,詳細分析了 Android 系統中定 位服務的架構和實現。定位服務是 Android 系統提
Android重力感應示例
android中的很多游戲的游戲都使用了重力感應的技術,就研究了一下重力感應以屏幕的左下方為原點,箭頭指向的 方向為正。從-10到10,以浮點數為等級單位,想象以下情形:
Android簡明開發教程十九:線程 Bezier曲線
Android中使用線程Thread的方法和Java SE相同。和大多數OS系統一樣,Android中也有稱為UI Thread的主線程。UI Thread 主要用來給相