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: Tạo NotePad docx
Nội dung xem thử
Mô tả chi tiết
Trung tâm Tin học – ĐH KHTN
Tạo NotePad
Hẳn các bạn đã quen với ứng dụng NotePad trên Window. Sau đây mình sẽ demo cách
tạo 1 ứng dụng NotePad với vài chức năng chỉnh sửa văn bản trên hệ điều hành
Android :
1/ Các bạo tạo Project như sau:
Project name: MyNoteEditer
Build Target: Android 2.1
Application name: MyNoteEditer
Package name: com.app.MyNoteEditer
Create Activity: OpenNotes
2/ Các bạn tạo file new_text.xml trong folder layout 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">
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Title" />
<EditText android:id="@+id/title"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Body Text" />
<EditText android:id="@+id/insertdata" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1"
android:scrollbars="vertical" />
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<Button android:id="@+id/save" android:text="Save"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<Button android:text="Cut" android:id="@+id/cut"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<Button android:text="Copy" android:id="@+id/copy"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<Button android:text="Paste" android:id="@+id/paste"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<Button android:text="Back" android:id="@+id/back"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
Lập trình Android – http://laptrinhdidong.vn Page 1