android输入法开发软件,开发安卓系统Android和码输入法软件的全过程(二)
2012年01月20日星期五
Android IMF給輸入軟件的編寫給出的規范,也提供了很多的方便。這里從例子程序SoftKeyboard來認識。
1、軟鍵盤界面的設計,可以用XML文件來做,這真是很方便。
android.inputmethodservice.Keyboard Class能把XML鍵盤文件,轉換成視圖。
android.inputmethodservice.KeyboardView 感知用戶觸鍵,發送出事件信息,根據需要改換鍵面的顯示。
2、Android 輸入法程序都要繼承InputMethodService類,這個類定義了輸入程序的全部活動,如:
onCreate()
onInitializeInterface()
onCreateInputView() 生成鍵盤界面
onCreateCandidatesView() 生成候選框界面
onStartInput()
onFinishInput()
onUpdateSelection()
onKey()這里你得到輸入鍵的信息,根據輸入鍵與前面保留的輸入狀態,生成候選字詞。
onKeyDown(), onKeyUp()
commitTyped() 完成輸入一個字詞。
等等。這些輸入過程在微軟與蘋果上都是一樣的。我在做iPhone/iPad上的獨立輸入程序時,所有這些過程都是自己分析設計的。
Android把輸入過程中要考慮的事件都為定義在Class里,大大地方便了輸入軟件編程。
3、CandidateView
CandidateView???????? 只是android.view 它在InputMethodService的onCreateCandidatesView()生成。依照Android IMF做出的輸入法,能與Android系統中的應用程序,以及系統輸入管理中心協調工作了。
在Mac OS X的IMKit中,CandidateView(候選框)是輸入管理中心給的,輸入法程序不需要做這部分的程序。
2012年01月21日
今天通過“Beginning Android Application Development” (Wrox Programmer to Programmer)???????? by Wei Meng???????? Lee這本書,繼續了解Android平臺所提供的功能,學習Android上的編程方法。書中介紹的Android平臺的多數技術內容,我都或多或少知道,如:
Layout, Screen Orientation,
View, List View, Picture, Menu
SQLite, Saving and Loading User Preferences, Content Providers
Messageing, Networking, Service
等等,這些不同的平臺(微軟與蘋果)都有相似的內容,差別不大。
有兩個概念我是第一次在Android中見到:Activity,和Intent,這是Android平臺編程的基本概念,是其它平臺沒有的概念。我在Java語言中沒有找到這兩個概念,這應該是Android的創新了。
Activity是application中定義有特定功能的一個圖形界面,用戶可以觸摸來完成一定的功能。特別的是這個Activity可以被Android系統的其它Application調用。
這就是說每個Application安裝到Android系統后,其中包括的Activity都要登記到Android系統中,這樣才能讓別的Application調用。
Intent:Application是通過Intent來調用Activity的,Intent就是代表Android系統來運行Activity的。
為了方便Intent找到Activity, 因此在定義Activity時,除了要給Activity名稱外,還有
intent-filter應用用于Activity的歸類,查找。
這兩個概念要認真地理解。
Android還有個別出心裁的地方:在Android的multi-user Linux system中,每個application是一個different???????? user. 以下摘自網頁:http://developer.android.com/guide/topics/fundamentals.html
Application Fundamentals:
Once installed on a device, each Android application lives in its own security???????? sandbox:
The Android operating system is a multi-user Linux system in which each???????? application is a different user.
By default, the system assigns each application a unique Linux user ID (the ID???????? is used only by the system and is unknown to the application). The system sets???????? permissions for all the files in an application so that only the user ID???????? assigned to that application can access them.
Each process has its own virtual machine (VM), so an application's code runs in???????? isolation from other applications.
By default, every application runs in its own Linux process. Android starts the???????? process when any of the application's components need to be executed, then shuts???????? down the process when it's no longer needed or when the system must recover???????? memory for other applications.
2012年01月22日(星期日)
上午看了2012央視春節晚會網上直播4個多小時,同祖國與世界華人一起歡歡樂樂地辭舊歲迎新年。
祝愿祖國風調雨順,國泰民安!
祝愿全世界的華人新年快樂,吉祥如意!
總結
以上是生活随笔為你收集整理的android输入法开发软件,开发安卓系统Android和码输入法软件的全过程(二)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: coreldraw凹槽_CATIA课时:
- 下一篇: android sina oauth2.