1. udphtml
2. websocketandroid
http://www.brightec.co.uk/ideas/communicating-between-two-devices-using-websocketsgit
3. cardviewgithub
邊框:web
https://stackoverflow.com/questions/35369691/how-to-add-colored-border-on-cardviewapi
<?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#808080"/> <stroke android:width="3dip" android:color="#B1BCBE" /> <corners android:radius="20dip"/> <padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" /> </shape>
4. 列表和卡片websocket
https://developer.android.com/training/material/lists-cards.html?hl=zh-cn 網絡
5. PreferenceActivity偏好/首選項設置app
和其餘activity不一樣,preferenceactivity使用xml而不是layout資源來定義佈局(因此找不到preferenceactivity對應的layout佈局文件)。socket
http://alvinalexander.com/android/android-tutorial-preferencescreen-preferenceactivity-preferencefragment
https://github.com/DreaminginCodeZH/SeekBarPreference
https://github.com/MrBIMC/MaterialSeekBarPreference
5.1 監聽preference值改變事件
須要在preferencefragment類中石油findpreference方法獲取preference對象,而後修改對應的key值,或者添加監聽函數。
https://github.com/codepath/android_guides/wiki/Settings-with-PreferenceFragment
5.2 使用支持庫添加官方seekbarpreference
安卓官方是支持seekbarpreference的,可是是api25版本之後的事情,要想在低版本上使用須要使用支持庫。
參考:
https://stackoverflow.com/questions/32070186/how-to-use-the-v7-v14-preference-support-library
https://storiesandroid.wordpress.com/2015/10/06/android-settings-using-preference-fragments/
結論,不管嘗試使用支持庫或者第三方的seekbarpreference都有問題。暫時先使用edittextpreference實現。
5.3 edittextpreference
5.4 返回上級頁面
1) toolbar 返回按鈕
mActionBar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_action_back)); mActionBar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //What to do on back clicked } });
https://stackoverflow.com/questions/26651602/display-back-arrow-on-toolbar-android
2) 恢復一個activity
Intent openMainActivity= new Intent(TerceraActiviry.this, Main.class)); openMainActivity.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivityIfNeeded(openMainActivity, 0);`
https://stackoverflow.com/questions/12408719/resume-activity-in-android
3)actionbar返回按鈕
actionbar已經被toolbar取代,這裏是由於用到preferenceactivity用到。
actionbar調用
setDisplayHomeAsUpEnabled
能夠使能返回按鈕,經過重載
onOptionsItemSelected
來響應返回按鈕點擊事件
參考:https://stackoverflow.com/questions/10108774/how-to-implement-the-android-actionbar-back-button
這裏有一個問題,那就是多級頁面共用一個actionbar時,如何肯定返回到哪一級頁面。
參考:
5.5 時間和時區
https://stackoverflow.com/questions/5533078/timepicker-in-preferencescreen
https://gist.github.com/bsara/b73fca6be70764c08f0c
https://github.com/wdullaer/MaterialDateTimePicker
5.6 dialogpreference
https://github.com/Gericop/Android-Support-Preference-V7-Fix/issues/52
6. listener
https://guides.codepath.com/android/Creating-Custom-Listeners
支持多個監聽器
https://stackoverflow.com/questions/2983250/custom-event-listener-on-android-app
7 bottomsheetdialog + recyclerview
https://stackoverflow.com/questions/36373122/update-recyclerview-contents-fail-in-the-bottom-sheet
http://www.jianshu.com/p/38af0cf77352
http://blog.csdn.net/qibin0506/article/details/51002241
8. 監聽網絡變化
https://developer.android.com/training/monitoring-device-state/connectivity-monitoring.html?hl=zh-cn
https://stackoverflow.com/questions/32547006/connectivitymanager-getnetworkinfoint-deprecated
https://stackoverflow.com/questions/5018545/getapplication-vs-getapplicationcontext