Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Lập trình Android: Notification docx
MIỄN PHÍ
Số trang
6
Kích thước
114.0 KB
Định dạng
PDF
Lượt xem
1288

Lập trình Android: Notification docx

Nội dung xem thử

Mô tả chi tiết

Trung tâm Tin học – ĐH KHTN

Tạo “Notification”

Sau đây mình sẽ tạo 1 demo nho nhỏ để tạo các Notice (nhắc nhở trên Android):

Đầu tiên các bạn tạo 1 project như sau:

Project name: NotificationExample

Build Target: Android 2.3.3

Application name: NotificationExample

Package name: org.example. NotificationExample

Create Activity: NotificationExample

Sau đó các bạn chỉnh sửa strings.xml như sau:

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

<resources>

<string name="hello">Hello World, NotificationExample!</string>

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

<string name="info">Notification Example, press the button Notification to add a

notification.</string>

<string name="btn_default_notification_text">Show Notification</string>

<string name="notification_string">This is the activity started when you press

the notification.</string>

</resources>

Tiếp theo các bạn chỉnh sửa file 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"

>

<LinearLayout

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_weight="0.9">

<TextView

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:gravity="center_vertical|center_horizontal"

android:text="@string/info"/>

</LinearLayout>

<LinearLayout

android:orientation="horizontal"

Lập trình Android – http://laptrinhdidong.vn Page 1

Tải ngay đi em, còn do dự, trời tối mất!