1. Trang chủ
  2. » Công Nghệ Thông Tin

Lập trình Android: Tạo BackGround pdf

3 335 1

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 3
Dung lượng 111 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Cách chèn hình tự chọn làm hình nền Sau đây mình sẽ demo cách bạn chọn 1 hình bất kỳ làm hình nền cho ứng dụng: 1/ Bạn tạo 1 project như sau: Project name: Global Build Target: Android 2

Trang 1

Cách chèn hình tự chọn làm hình nền Sau đây mình sẽ demo cách bạn chọn 1 hình bất kỳ làm hình nền cho ứng dụng: 1/ Bạn tạo 1 project như sau:

Project name: Global

Build Target: Android 2.3.3

Application name: Global

Package name: org.example.GlobalExample

Create Activity: GlobalExample

2/ Trong phần main.xml bạn chỉnh lại như sau:

<?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"

/>

<RelativeLayout android:layout_width ="fill_parent"

android:layout_height ="fill_parent"

xmlns:android ="http://schemas.android.com/apk/res/android"

android:id ="@+id/iclLayout">

<TextView android:layout_width ="wrap_content"

android:layout_height ="wrap_content"

android:text ="@string/info_text"

android:layout_alignParentBottom ="true"

Trang 2

3/ Bạn tạo thêm 1 folder “drawable” trong phần “res” và Import 1 image vào trong drawable Tiếp theo bạn rename Image lại thành “background” (lưu ý bỏ đuôi png) 4/ Sau đó bạn chỉnh file strings.xml như sau:

<?xml version ="1.0" encoding ="utf-8"?>

<resources>

<string name ="hello">Hello, Hi`nh ne`</string>

<string name ="app_name">Global</string>

<string name ="info_text">Trái đất</string>

</resources>

5/ Để thêm phần màu mè bạn thêm 1 file color.xml vào thư mục values(trong thư mục res) Và code vào như sau:

<?xml version ="1.0" encoding ="UTF-8"?>

<resources>

<color name ="Orange">#ff3300</color>

</resources>

Cuối cùng bạn cho Debug ứng dụng và sẽ được kết quả như sau:

Trang 3

Các bạn có thể đóng góp ý kiến, trao đổi bằng cách post bài vào forum trang web

www.laptrinhdidong.vn Mình sẽ cập nhật forum thường xuyên ^^

Ngày đăng: 07/08/2014, 08:22

TỪ KHÓA LIÊN QUAN

w