<LinearLayout ... >
<TextView ... android:layout_weight="1"/>
<TextView ... android:layout_weight="1"/>
<TextView ... android:layout_weight="1"/>
</LinearLayout>
<LinearLayout ... >
<TextView ... android:layout_weight="1"/>
<TextView ... android:layout_weight="1"/>
<TextView ... android:layout_weight="1"/>
</LinearLayout>
有時候程式想讓他暫停個幾秒在運作 但又不想用太難的技巧 可參考下面 ================= 在Method裡
//想暫停的時候 try { Thread.sleep(3000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); }//毫秒的意思 3000就是3秒 以此類推
-----如果想透過Thread傳值 或 改變TextView 的文字或跳出Toast 就必須要加入Handler----- 如果運算比較長或是不希望造成Activity暫停回應的狀況, 會將運算的部分另開一個Thread,而在Thread中並沒有辦法改變畫面上的任何UI,所以會使用Handler來完成UI更新的目的
//存入資料 SharedPreferences settings = null; SharedPreferences.Editor editor = settings.edit(); editor.putInt("IntKey",50); editor.commit();//要記得加 //取得資料 String PREFS_NAME = "test.this.activity";//一個標籤 可以設定為代表此APP的String Tag int getInt ; settings = getSharedPreferences(PREFS_NAME, 0); getInt = settings.getInt("IntKey",0);//settings.getInt(所對應的key,如果抓不到對應的值要給什麼預設值)
先在onCreate裡的setContentView上面加入
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);//讓程式允許標題列加入圖片