將LinearLayout中的元件置中對齊
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" >
將LinearLayout中的元件置中對齊
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" >
只要在 "AndroidManifest.xml "的activity屬性裡加兩個屬性即可
<activity
android:name=".Main"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:label="@string/title_activity_main" >
如何進入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 不知要連到哪台模擬器),這時需要指定模擬器序號
>adb devices //查詢有哪些模擬器
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. 事件處理最主要都在處理兩件事 :
(1). 明確跟系統(註冊)說什麼時候(事)幫忙做事, ex: setOnClickListener()
(2). 做什麼事, ex: onClick()
6.@id與@+id之間的差異在於原本Layout裡沒有那個元件(strings.xml在Create layout時就已建立reference了,所以要用@id),
所以新增一個元件(ex:Button)時,要用@+id reference給一個變數
7.希望在實機上啟動debug mode , 在manifest.xml 的<application>內加上 「android: debuggable="true"」
設定多國語言
1.按下
(Open a wizard to help careate a new Android XML file) ,
2.建立strings.xml
Resource Type選擇:「Values」
Project 選擇:「要做多國語言的專案」
每天中午都不知要吃什麼好,乾脆將常吃的幾家餐廳統計一下,用簡單的程式來博杯今天要吃哪一家吧!!
package com.alan;
import java.util.Random;
import java.io.*;
public class LunchRandon{
private static void riceChoiceRandom(int a){
String[] riceArray = {"A","B","C","D","E"};
System.out.println(riceArray[a]);
}
private static void noodleChoiceRandom(int a){
String[] noodleArray = {"A","B","C"};
System.out.println(noodleArray[a]);
}
/**
*args1 : 飯、麵分類選擇
*args2 : 飯、麵目前登錄於程式中的餐廳
*/
public static void getRandom(int lunchCategory){
Random r = new Random();
int n = (int)(10.0 * Math.random());
int limit = 0;
if(lunchCategory == 1){
limit = 5;
}else if(lunchCategory == 2){
limit = 3;
}
if(n < limit){
if(lunchCategory == 1){
LunchRandon.riceChoiceRandom(n);
}else{
LunchRandon.noodleChoiceRandom(n);
}
}else{
LunchRandon.getRandom(lunchCategory);
}
}
開發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
3.2 Help/Install New Software/Add/Archive , 選擇下載的ADT檔案
3.3 安裝ADT套件的Developer Tools
3.4 重啟Eclipse
案例: 甲乙兩人約好隔天要去殺丙, 但乙隔日未告知甲就跑回家睡覺,甲等不到乙,獨自跑去殺丙,試問乙要不要為甲的殺人行為負責?
客觀歸責理論:共同製造了風險
共同正犯:一人的行為視同其他人的行為 (責任分擔問題)
乙逕自回家睡覺雖未和甲去殺丙,但甲和乙共謀殺丙已製造了風險。
參考網址:http://diablo.incgamers.com/forums/showthread.php?t=809794
在原本的討論區中還列出了很多不支援或支援度較低的顯卡,
但既然要玩暗黑這種史詩級的大作,當然要具備好一點的顯卡再來玩啊
不過在此還是也把支援度中等的一併列出來