android ui develop

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://stackoverflow.com/questions/15624026/how-to-set-preference-summary-without-the-deprecated-method-findpreference-for-a

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

https://stackoverflow.com/questions/38553820/let-the-user-choose-from-a-range-of-numbers-in-preference-screen

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时,如何肯定返回到哪一级页面。

参考:

https://stackoverflow.com/questions/5719287/should-android-onoptionsitemselected-return-true-or-false

5.5 时间和时区

https://stackoverflow.com/questions/5533078/timepicker-in-preferencescreen

https://gist.github.com/bsara/b73fca6be70764c08f0c

https://github.com/wdullaer/MaterialDateTimePicker

https://stackoverflow.com/questions/14933330/datepicker-how-to-popup-datepicker-when-click-on-edittext

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/37555403/android-bottomsheetdialogfragment-does-not-expand-completely

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://stackoverflow.com/questions/15546712/unfortunately-app-is-getting-stopped-while-checking-for-network/15546897#15546897

https://stackoverflow.com/questions/15698790/broadcast-receiver-for-checking-internet-connection-in-android-app

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

相关文章
相关标签/搜索