Android畢業(yè)設(shè)計(jì)備忘錄APP
源碼放到GitHub上了,大家可以看一下 https://github.com/become-better1/hh
1.系統(tǒng)需求分析
1.1 系統(tǒng)功能及框圖
該項(xiàng)目實(shí)現(xiàn)了備忘錄的創(chuàng)建,修改,刪除,查詢,對(duì)備忘錄數(shù)目的統(tǒng)計(jì)和軟件的說(shuō)明。
1.2 系統(tǒng)需求
功能&說(shuō)明
備忘錄的創(chuàng)建 主鍵自動(dòng)生成,將控件中的數(shù)據(jù)對(duì)Word字段進(jìn)行賦值
備忘錄的修改 將控件中的數(shù)據(jù)對(duì)Word字段進(jìn)行賦值,查詢條件是與原先的Word字段相等
備忘錄的查詢 對(duì)Word字段進(jìn)行查詢,查詢條件是與控件中的數(shù)據(jù)相等
備忘錄的刪除 按照Word字段進(jìn)行刪除,查詢條件是與控件中的數(shù)據(jù)相等
備忘錄數(shù)目的統(tǒng)計(jì) 通過(guò)SharedPrefenrences來(lái)存儲(chǔ)和讀取數(shù)據(jù)
軟件的說(shuō)明 進(jìn)一步的描述
1.3 該項(xiàng)目涉及到的技術(shù)點(diǎn)
界面控件:TextView,EditText,Button,ImageButton,ListView,View
布局:線性布局
事件:監(jiān)聽(tīng)事件
數(shù)據(jù)存儲(chǔ):SharedPrefenrences,SQLite存儲(chǔ)
Activity和Intent
2.數(shù)據(jù)存儲(chǔ)設(shè)計(jì)
2.1 SharedPrefenrences/SQLite存儲(chǔ)介紹
SharedPrefenrences :
SharedPreferences是Android平臺(tái)上一個(gè)輕量級(jí)的存儲(chǔ)類,用來(lái)保存應(yīng)用的一些常用配置,比如Activity狀態(tài),Activity暫停時(shí),將此activity的狀態(tài)保存到SharedPereferences中;當(dāng)Activity重載,系統(tǒng)回調(diào)方法onSaveInstanceState時(shí),再?gòu)腟haredPreferences中將值取出。
SharedPreferences提供了java常規(guī)的Long、Int、String等類型數(shù)據(jù)的保存接口。 [SharedPreferences類似過(guò)去Windows系統(tǒng)上的ini配置文件,但是它分為多種權(quán)限,可以全局共享訪問(wèn)。
提示最終是以xml方式來(lái)保存,整體效率來(lái)看不是特別的高,對(duì)于常規(guī)的輕量級(jí)而言比SQLite要好不少,如果真的存儲(chǔ)量不大可以考慮自己定義文件格式。xml處理時(shí)Dalvik會(huì)通過(guò)自帶底層的本地XML Parser解析,比如XMLpull方式,這樣對(duì)于內(nèi)存資源占用比較好。
文件存儲(chǔ)
文件存儲(chǔ)是Android中最基本的一種數(shù)據(jù)存儲(chǔ)方式,它不對(duì)存儲(chǔ)的內(nèi)容進(jìn)行任何的格式化處理,所有數(shù)據(jù)都是原封不動(dòng)的保存到文件當(dāng)中,因而它比較適合用于存儲(chǔ)一些簡(jiǎn)單的文本數(shù)據(jù)或者二進(jìn)制數(shù)據(jù)。如果你想使用文件存儲(chǔ)的方式來(lái)保存一些較為復(fù)雜的文本數(shù)據(jù),就需要定義一套自己的格式規(guī)范以方便將數(shù)據(jù)從文件中重新解析出來(lái)。
Context類中提供了一個(gè)openFileOutput()方法,可以用于將數(shù)據(jù)存儲(chǔ)到指定的文件中。這個(gè)方法有兩個(gè)參數(shù),第一個(gè)參數(shù)是文件名,在文件創(chuàng)建的時(shí)候使用的就是這個(gè)名稱,(文件的位置是默認(rèn) 存儲(chǔ)到/data/data/packagename/files/目錄下的)第二個(gè)參數(shù)就是文件的操作模式,主要有兩種模式可選:MODE_PRIVATE和 MODE_APPEND,其中MODE_PRIVATE是默認(rèn)的操作模式,表示當(dāng)指定文件已存在,所寫入的內(nèi)容將會(huì)覆蓋源文件中的內(nèi)容,而MODE_APPEND則表示如果該文件已存在,就往文件里追加內(nèi)容,不存在就創(chuàng)建新文件
SQLite存儲(chǔ)
①SQLite是一個(gè)輕量級(jí)的關(guān)系型數(shù)據(jù)庫(kù),運(yùn)算速度快,占用資源少,很適合在移動(dòng)設(shè)備上使用, 不僅支持標(biāo)準(zhǔn)SQL語(yǔ)法,還遵循ACID(數(shù)據(jù)庫(kù)事務(wù))原則,無(wú)需賬號(hào),使用起來(lái)非常方便!
②但是在很多情況下, 文件并不一定是有效的,如多線程并發(fā)訪問(wèn)是相關(guān)的;app要處理可能變化的復(fù)雜數(shù)據(jù)結(jié)構(gòu)等等! 比如銀行的存錢與取錢!使用前兩者就會(huì)顯得很無(wú)力或者繁瑣,數(shù)據(jù)庫(kù)的出現(xiàn)可以解決這種問(wèn)題, 而Android又給我們提供了這樣一個(gè)輕量級(jí)的SQLite,為何不用?
③SQLite支持五種數(shù)據(jù)類型:NULL,INTEGER,REAL(浮點(diǎn)數(shù)),TEXT(字符串文本)和BLOB(二進(jìn)制對(duì)象) 雖然只有五種,但是對(duì)于varchar,char等其他數(shù)據(jù)類型都是可以保存的;因?yàn)镾QLite有個(gè)最大的特點(diǎn):你可以各種數(shù)據(jù)類型的數(shù)據(jù)保存到任何字段中而不用關(guān)心字段聲明的數(shù)據(jù)類型是什么,比如你 可以在Integer類型的字段中存放字符串,當(dāng)然除了聲明為主鍵INTEGER PRIMARY KEY的字段只能夠存儲(chǔ)64位整數(shù)! 另外, SQLite 在解析CREATE TABLE 語(yǔ)句時(shí), 會(huì)忽略 CREATE TABLE 語(yǔ)句中跟在字段名后面的數(shù)據(jù)類型信息如下面語(yǔ)句會(huì)忽略 name字段的類型信息:CREATE TABLE person (personid integer primary key autoincrement, name varchar(20))
2.2數(shù)據(jù)表結(jié)構(gòu)
給出使用的數(shù)據(jù)庫(kù)的邏輯結(jié)構(gòu),需要說(shuō)明各字段屬性及含義
Id:作為主鍵,自帶生成
Word:進(jìn)行存儲(chǔ)備忘錄的信息
SharedPrefenrences代碼
```java SharedPreferences sharedP=getSharedPreferences("SaveTable",MODE_PRIVATE); SharedPreferences.Editor editor=sharedP.edit(); int num=sharedP.getInt("number", 0); num++; editor.putInt("number", num); editor.commit();
數(shù)據(jù)庫(kù)封裝代碼: ```java package com.example.coursedesign; import java.util.ArrayList; import java.util.List; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; public class DBOpenHelper extends SQLiteOpenHelper { final String CREATE_TABLE_SQL="create table myTable(_id integer primary key autoincrement,word text)"; public static final String name = "myDb"; public static final String table_name = "myTable"; public DBOpenHelper( Context context, String name, SQLiteDatabase.CursorFactory factory, int version) { super(context, name, null, version); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(CREATE_TABLE_SQL); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.i("生活小助手","--版本更新"+oldVersion+"-->"+newVersion); } public List<String> readAll () { List<String> allCommodities = new ArrayList<String>(); SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery("select * from myTable order by _id",null); if(cursor.moveToFirst()) { do { String title = cursor.getString(cursor.getColumnIndex("word")); allCommodities.add(title); }while (cursor.moveToNext()); } cursor.close(); return allCommodities; } public boolean addMyCollection(String s) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put("word",s); db.insert(table_name,null,values); values.clear(); return true; } public void delete(String word) { SQLiteDatabase db = this.getWritableDatabase(); if(db.isOpen()) { db.delete(table_name,"word=?",new String[]{word+""}); db.close(); } } public boolean update (String word,String wordP) { SQLiteDatabase db = this.getWritableDatabase(); String sql = "update myTable set word=? where word=?"; String[] obj = new String[]{word,wordP}; db.execSQL(sql,obj); return true; } }
3.具體編碼及截圖
3.1 主界面
通過(guò)listView來(lái)顯示所有的備忘錄,界面含有主頁(yè),刷新,添加,個(gè)人中心的功能。
界面代碼:
<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" android:background="@drawable/blue" tools:context="com.example.coursedesign.MainActivity" > <ListView android:id="@+id/main_list" android:layout_width="match_parent" android:layout_height="370dp" android:layout_marginTop="4dp" android:layout_weight="1.19" /> <View android:id="@+id/view1" android:layout_width="match_parent" android:layout_height="2dp" android:layout_marginTop="50dp" android:background="@drawable/green" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <ImageButton android:id="@+id/ib_home_page" android:layout_width="58dp" android:layout_height="55dp" android:src="@drawable/home" /> <View android:id="@+id/view2" android:layout_width="2dp" android:layout_height="55dp" android:background="@drawable/green" /> <ImageButton android:id="@+id/ib_add_product" android:layout_width="58dp" android:layout_height="55dp" android:src="@drawable/add" /> <View android:id="@+id/view3" android:layout_width="2dp" android:layout_height="55dp" android:background="@drawable/green" /> <ImageButton android:id="@+id/refresh" android:layout_width="58dp" android:layout_height="55dp" android:src="@drawable/refresh" /> <View android:id="@+id/view4" android:layout_width="2dp" android:layout_height="55dp" android:background="@drawable/green" /> <ImageButton android:id="@+id/ib_personal_center" android:layout_width="50dp" android:layout_height="55dp" android:layout_weight="0.84" android:src="@drawable/person" /> </LinearLayout> </LinearLayout>
后臺(tái)代碼:
package com.example.coursedesign; import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ImageButton; import android.widget.ListView; import android.widget.Toast; public class MainActivity extends Activity { ImageButton buttonRefresh; ImageButton buttonAdd; ImageButton buttonHome; ImageButton buttonPerson; DBOpenHelper dbHelper; List<String> listString=new ArrayList<String>(); ListView listview; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); dbHelper = new DBOpenHelper(getApplicationContext(),DBOpenHelper.name , null, 1); buttonRefresh=(ImageButton) findViewById(R.id.refresh);//刷新 listview=(ListView) findViewById( R.id.main_list); buttonRefresh.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { listString = dbHelper.readAllCommodities(); ArrayAdapter<String> adapter=new ArrayAdapter<String>(MainActivity.this, android.R.layout.simple_list_item_1,listString); listview.setAdapter(adapter); } }); listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {///List @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String s = (String) listview.getAdapter().getItem(position); Bundle bundle1 = new Bundle(); bundle1.putInt("position",position); bundle1.putString("title",s); Intent intent = new Intent(MainActivity.this, ListViewActivity.class); intent.putExtras(bundle1); startActivity(intent); } }); buttonAdd=(ImageButton) findViewById(R.id.ib_add_product);//Add buttonAdd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, AddActivity.class); startActivity(intent); } }); buttonHome=(ImageButton) findViewById(R.id.ib_home_page);//home buttonHome.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(), "已在主頁(yè)", Toast.LENGTH_SHORT).show(); } }); buttonPerson=(ImageButton) findViewById(R.id.ib_personal_center);///person buttonPerson.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, PersonActivity.class); startActivity(intent); Toast.makeText(getApplicationContext(), "進(jìn)入個(gè)人中心", Toast.LENGTH_SHORT).show(); } }); } }
3.2 各功能模塊
添加備忘錄:
界面
通過(guò)SQLite數(shù)據(jù)實(shí)現(xiàn)對(duì)備忘錄的添加。
界面代碼:
<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" android:background="@drawable/blue" tools:context="com.example.coursedesign.AddActivity" > <View android:layout_width="match_parent" android:layout_height="50dp" /> <EditText android:id="@+id/add_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="請(qǐng)輸入添加的信息" /> <View android:layout_width="match_parent" android:layout_height="120dp" /> <Button android:id="@+id/add_button" android:layout_gravity="center_horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="提交" /> </LinearLayout>
后臺(tái)代碼:
package com.example.coursedesign; import android.app.Activity; import android.app.backup.SharedPreferencesBackupHelper; import android.content.SharedPreferences; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class AddActivity extends Activity { Button button; EditText editText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add); button=(Button) findViewById(R.id.add_button); editText=(EditText) findViewById(R.id.add_text); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String s=editText.getText().toString(); DBOpenHelper dbHelper = new DBOpenHelper(getApplicationContext(), DBOpenHelper.name, null, 1); if(s!=null){ if(dbHelper.addMyCollection(s)){ Toast.makeText(getApplicationContext(), "添加成功", Toast.LENGTH_SHORT).show(); SharedPreferences sharedP=getSharedPreferences("SaveTable",MODE_PRIVATE); SharedPreferences.Editor editor=sharedP.edit(); int num=sharedP.getInt("number", 0); num++; editor.putInt("number", num); editor.commit(); finish(); } else{ Toast.makeText(getApplicationContext(), "添加失敗", Toast.LENGTH_SHORT).show(); } } } }); } }
刪除和修改備忘錄:
通過(guò)SQLite數(shù)據(jù)實(shí)現(xiàn)對(duì)備忘錄的修改和刪除。
界面:
界面代碼:
<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" android:background="@drawable/blue" tools:context="com.example.coursedesign.ListViewActivity" > <EditText android:id="@+id/listView_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="你好" /> <View android:layout_width="match_parent" android:layout_height="120dp" /> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_horizontal"> <View android:layout_width="20dp" android:layout_height="wrap_content" /> <Button android:id="@+id/listView_updata" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="修改" /> <View android:layout_width="90dp" android:layout_height="wrap_content" /> <Button android:id="@+id/listView_delete" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="刪除" /> </LinearLayout> </LinearLayout>
后臺(tái)代碼:
package com.example.coursedesign; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class ListViewActivity extends Activity { EditText text; Button button_up; Button button_delete; int position; String str; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list_view); text=(EditText) findViewById(R.id.listView_text); button_delete=(Button) findViewById(R.id.listView_delete); button_up=(Button) findViewById(R.id.listView_updata); Bundle b = getIntent().getExtras(); if( b != null) { str=b.getString("title"); //Toast.makeText(getApplicationContext(), str, Toast.LENGTH_SHORT).show(); text.setText(str.toCharArray(), 0, str.length()); position = b.getInt("position"); } button_delete.setOnClickListener(new View.OnClickListener() {//delete @Override public void onClick(View v) { DBOpenHelper dbHelper = new DBOpenHelper(getApplicationContext(), DBOpenHelper.name, null, 1); dbHelper.deleteMyCollection(str); Toast.makeText(getApplicationContext(), "刪除成功", Toast.LENGTH_SHORT).show(); finish(); } }); button_up.setOnClickListener(new View.OnClickListener() {//delete @Override public void onClick(View v) { String wordNew=""; wordNew=text.getText().toString(); DBOpenHelper dbHelper = new DBOpenHelper(getApplicationContext(), DBOpenHelper.name, null, 1); if(dbHelper.updateUser(wordNew, str)){ Toast.makeText(getApplicationContext(), "更新成功", Toast.LENGTH_SHORT).show(); finish(); } } }); } }
進(jìn)入頁(yè)面:
通過(guò)使用Intent進(jìn)行Activity的啟動(dòng)。
界面:
界面代碼:
<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" android:background="@drawable/note2" tools:context="com.example.coursedesign.FirstActivity" > <View android:layout_width="150dp" android:layout_height="79dp"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="歡迎來(lái)到生活小助手" android:layout_gravity="center_horizontal" android:textColor="#68EE68" android:textSize="24dp" android:textStyle="bold"/> <View android:layout_width="150dp" android:layout_height="79dp"/> <Button android:id="@+id/Loading" android:layout_width="70dp" android:layout_height="40dp" android:background="@drawable/green1" android:text="進(jìn)入" android:layout_gravity="center_horizontal" android:textColor="#F24FFF" android:textSize="30dp" android:textStyle="bold" tools:ignore="MissingConstraints" /> </LinearLayout>
后臺(tái)代碼:
package com.example.coursedesign; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ImageButton; public class FirstActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_first); Button button=(Button) findViewById(R.id.Loading); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(FirstActivity.this, MainActivity.class); startActivity(intent); } }); } }
個(gè)人中心
備忘錄數(shù)量的統(tǒng)計(jì)以及軟件的說(shuō)明
界面:
界面代碼:
<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" android:background="@drawable/blue" tools:context="com.example.coursedesign.PersonActivity" > <TextView android:layout_width="match_parent" android:layout_height="30dp" android:background="@drawable/green1" android:gravity="center_horizontal" android:text="個(gè)人中心" android:textSize="20sp" android:textStyle="italic" /> <View android:layout_width="2dp" android:layout_height="0dp" /> <TextView android:layout_width="match_parent" android:layout_marginTop="12dp" android:layout_height="25dp" android:background="@drawable/yellow" android:gravity="center_horizontal" android:text="您的記錄總共為" android:textSize="20sp" android:textStyle="italic" /> <TextView android:id="@+id/person_text" android:layout_width="match_parent" android:layout_height="89dp" android:background="@drawable/yellow" android:gravity="center_horizontal" android:text="50" android:textSize="85sp" android:textStyle="italic" /> <Button android:id="@+id/person_button" android:layout_width="140dp" android:layout_height="38dp" android:layout_marginTop="16dp" android:layout_gravity="center_horizontal" android:background="@drawable/white" android:text="軟件介紹" /> <View android:layout_width="match_parent" android:layout_height="2dp" android:layout_marginTop="10dp" android:background="@drawable/green" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <ImageButton android:id="@+id/person_home_page" android:layout_width="58dp" android:layout_height="55dp" android:src="@drawable/home" /> <View android:layout_width="2dp" android:layout_height="55dp" android:background="@drawable/green" /> <ImageButton android:id="@+id/person_add_product" android:layout_width="58dp" android:layout_height="55dp" android:src="@drawable/add" /> <View android:layout_width="2dp" android:layout_height="55dp" android:background="@drawable/green" /> <ImageButton android:id="@+id/person_refresh" android:layout_width="58dp" android:layout_height="55dp" android:src="@drawable/refresh" /> <View android:layout_width="2dp" android:layout_height="55dp" android:background="@drawable/green" /> <ImageButton android:id="@+id/person_personal_center" android:layout_width="50dp" android:layout_height="55dp" android:layout_weight="0.84" android:src="@drawable/person" /> </LinearLayout> </LinearLayout>
后臺(tái)代碼:
package com.example.coursedesign; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.TextView; public class PersonActivity extends Activity { TextView text; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_person); SharedPreferences sharedP=getSharedPreferences("SaveTable",MODE_PRIVATE); int num=sharedP.getInt("number", 0); Integer num2=(Integer)num; text=(TextView) findViewById(R.id.person_text); text.setText(num2.toString()); Button button=(Button) findViewById(R.id.person_button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(PersonActivity.this, AppActivity.class); startActivity(intent); } }); } }
軟件說(shuō)明:
對(duì)軟件的進(jìn)一步說(shuō)明。
界面:
界面代碼:
<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" android:background="@drawable/blue" tools:context="com.example.coursedesign.AppActivity" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="開(kāi)發(fā)目的:" android:textSize="20sp" android:layout_marginTop="5dp" android:layout_marginStart="5dp"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="它是幫助你忘記的事情,在每個(gè)人忙碌的生活當(dāng)中,人的記憶是有限的,備忘錄就是讓你把多個(gè)事情都能記起的東西。" android:textSize="15sp" android:layout_marginStart="5dp" android:layout_marginEnd="5dp" android:layout_marginTop="5dp"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="開(kāi)發(fā)人員:" android:textSize="20sp" android:layout_marginTop="5dp" android:layout_marginStart="5dp"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="何昊" android:textSize="15sp" android:layout_marginTop="5dp" android:layout_marginStart="5dp"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="系統(tǒng)版本:" android:textSize="20sp" android:layout_marginTop="5dp" android:layout_marginStart="5dp"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="android app v1.0.0" android:textSize="15sp" android:layout_marginTop="5dp" android:layout_marginStart="5dp"/> <Button android:id="@+id/person_button" android:layout_width="150dp" android:layout_height="50dp" android:text="返回" android:textSize="20sp" android:layout_marginTop="5dp" android:layout_gravity="center_horizontal"/> </LinearLayout>
后臺(tái)代碼:
package com.example.coursedesign; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; public class AppActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_app); Button button = (Button) findViewById(R.id.person_button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } }
4 總結(jié)
談一下發(fā)現(xiàn)的問(wèn)題與收獲:
- 開(kāi)始時(shí)使用相對(duì)布局進(jìn)行設(shè)計(jì),以為可以通過(guò)簡(jiǎn)單的拖拽就可以實(shí)現(xiàn)布局的設(shè)計(jì),后面發(fā)現(xiàn)在控件變多的時(shí)候,變得很麻煩,并且由于界面的選擇,eclipse這邊的界面與模擬器的界面并不相同。后來(lái)使用線性布局進(jìn)行設(shè)計(jì)。
- 之前上課學(xué)過(guò)openOrCreateDatabase方法與SQLitreOpenHelper類,存在有一些不明白的問(wèn)題,通過(guò)這次課設(shè),掌握了這些知識(shí)。
- 對(duì)時(shí)間規(guī)劃不足,使得項(xiàng)目結(jié)束時(shí)間有點(diǎn)晚。
到此這篇關(guān)于Android畢業(yè)設(shè)計(jì)備忘錄APP的文章就介紹到這了,更多相關(guān)Android備忘錄內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
android實(shí)現(xiàn)動(dòng)態(tài)顯示隱藏進(jìn)度條
這篇文章主要為大家詳細(xì)介紹了android實(shí)現(xiàn)動(dòng)態(tài)顯示隱藏進(jìn)度條,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-08-08Android自定義View實(shí)現(xiàn)等級(jí)滑動(dòng)條的實(shí)例
這篇文章主要介紹了 Android自定義View實(shí)現(xiàn)等級(jí)滑動(dòng)條的實(shí)例的相關(guān)資料,需要的朋友可以參考下2017-04-04Android 網(wǎng)絡(luò)圖片查看器與網(wǎng)頁(yè)源碼查看器
本篇文章主要介紹了Android 網(wǎng)絡(luò)圖片查看器與網(wǎng)頁(yè)源碼查看器的相關(guān)知識(shí)。具有很好的參考價(jià)值。下面跟著小編一起來(lái)看下吧2017-04-04Android開(kāi)發(fā)實(shí)現(xiàn)調(diào)節(jié)屏幕亮度功能
這篇文章主要介紹了Android開(kāi)發(fā)實(shí)現(xiàn)調(diào)節(jié)屏幕亮度功能,涉及Android權(quán)限控制及屏幕亮度相關(guān)屬性操作技巧,需要的朋友可以參考下2018-03-03Android編程開(kāi)發(fā)之在Canvas中利用Path繪制基本圖形(圓形,矩形,橢圓,三角形等)
這篇文章主要介紹了Android編程開(kāi)發(fā)之在Canvas中利用Path繪制基本圖形的方法,涉及Android基本的圖形繪制技巧,結(jié)合實(shí)例分析了繪制圓形,矩形,橢圓,三角形等基本圖形的實(shí)現(xiàn)方法,需要的朋友可以參考下2016-01-01Android sd卡讀取數(shù)據(jù)庫(kù)實(shí)例代碼
這篇文章主要介紹了Android sd卡讀取數(shù)據(jù)庫(kù)實(shí)例代碼的相關(guān)資料,需要的朋友可以參考下2017-02-02Android 三種實(shí)現(xiàn)定時(shí)器詳解及實(shí)現(xiàn)方法
本文主要介紹 Android 定時(shí)器的知識(shí)資料,這里整理了三種方法來(lái)實(shí)現(xiàn)定時(shí)器的方法,有需要的小伙伴可以參考下2016-09-09Android中Home鍵的監(jiān)聽(tīng)和攔截示例
本篇文章主要介紹了Android中Home鍵的監(jiān)聽(tīng)和攔截示例,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-02-02仿餓了嗎點(diǎn)餐界面兩個(gè)ListView聯(lián)動(dòng)效果
這篇文章主要介紹了仿餓了點(diǎn)餐界面2個(gè)ListView聯(lián)動(dòng)效果的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-09-09