底下程式碼的目的是想藉由動態的方式改變Spinner顯示的字
private void findView(){
Spinner categorySp = null;
射手奶爸 發表在 痞客邦 留言(0) 人氣(921)
Spinner itemSp = (Spinner)findViewById(R.id.itemSp);
itemSp.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view,int position, long id) {
// TODO Auto-generated method stub
String spStr = String.valueOf(adapterView.getSelectedItemId()); //取得選取的ID ; 若要取得選取的文字,可改用getSelectedItem()
Toast.makeText(Main.this, spStr,
Toast.LENGTH_SHORT).show();
}
射手奶爸 發表在 痞客邦 留言(0) 人氣(2,372)
將LinearLayout中的元件置中對齊
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" >
射手奶爸 發表在 痞客邦 留言(1) 人氣(22,904)
只要在 "AndroidManifest.xml "的activity屬性裡加兩個屬性即可
<activity
android:name=".Main"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:label="@string/title_activity_main" >
射手奶爸 發表在 痞客邦 留言(0) 人氣(500)
如何進入SQLite環境
1. find the SDK adb.exe , and open dos window then entry to sdk folder.
ex:C:\android-sdk-windows\platform-tools\adb shell
如果同時開啟多個模擬器,上述的指令會發生錯誤(adb 不知要連到哪台模擬器),這時需要指定模擬器序號
射手奶爸 發表在 痞客邦 留言(0) 人氣(145)
1. eclipse自動提示 : alt + /
2. UI的兩大類 widget: UI的基本單位,ex: Button、EditText、CheckBox
layout: like容器,可以再放入其它的容器或widget, ex: LinearLayout、RelativeLayout、TableLayout
ViewGroup為layout的root class
3. layout's width及height屬性: fill_parenet : 跟父元件一樣(高/寬) -->已經快被取消
match_parenet : 跟fill_parenet一樣的意思(現在都用這個屬性)
wrap_content: 只要能包覆widget的高/寬即可
4. 叫出屬性視窗(Properties) : Show In->Properties
5. 事件處理最主要都在處理兩件事 :
射手奶爸 發表在 痞客邦 留言(0) 人氣(87)

設定多國語言
1.按下 (Open a wizard to help careate a new Android XML file) ,
2.建立strings.xml
射手奶爸 發表在 痞客邦 留言(0) 人氣(1,259)
開發Android應用程式工具
1 JDK 1.6
2 Eclipse 3.4以上(建議下載EE版)
3 ADT : 專為Eclipse設計的外掛程式 ~
3.1 至Android官網下載 http://developer.android.com/sdk/installing/installing-adt.html
射手奶爸 發表在 痞客邦 留言(0) 人氣(208)