如果target到API 21,有一些注意的事项,以下是目前我发现的两个问题
1. Service must be explitict,从Lollipop开始,service必须显性声明,解决方案:http://blog.android-develop.com/2014/10/android-l-api-21-javalangillegalargumen.html
源代码参考
`sdk/sources/android-21/android/app/ContextImpl.java`

 private void validateServiceIntent(Intent service) {
if (service.getComponent() == null && service.getPackage() == null) {
if (getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.LOLLIPOP) {
IllegalArgumentException ex = new IllegalArgumentException(
"Service Intent must be explicit: " + service);
throw ex;
} else {
Log.w(TAG, "Implicit intents with startService are not safe: " + service
+ " " + Debug.getCallers(2, 3));
}
}
}

2. Material Design 按钮文字默认大写,相关链接:https://code.google.com/p/android-developer-preview/issues/detail?id=487,奇怪吧,看看源代码就知道

    <style name="TextAppearance.Material.Button">
<item name="textSize">@dimen/text_size_button_material</item>
<item name="fontFamily">@string/font_family_button_material</item>
<item name="textAllCaps">true</item>
<item name="textColor">?attr/textColorPrimary</item>
</style>

3. 补充一点, 谢谢@King Sing提供。 JobScheduler 是可以通过System serviceContext.getSystemService(Context.JOB_SCHEDULER_SERVICE)来获得的,它不依赖于implicit service或者是explicit service,但explicit service是可以与JobScheduler交互,参考sample,https://github.com/googlesamples/-JobScheduler。 在app中声明的explicit service,用电是在app头上,所以使用者看到的结果是android os 耗电不会很高,取而代之是各种app在耗电list裹。

4. Material Design Action Bar 默认是有shadow的,是因为新的elevation API, 所以你想去除它,要买在action bar style 的xml中,定义elevation 属性为0,要么

 getActionBar().setElevation(0)

最新文章

  1. 普林斯顿算法课第四周作业_8Puzzle
  2. ubuntu 搭建PPTP VPN服务器
  3. STL源码--序列式容器
  4. go 的 time ticker 设置定时器
  5. maven pom.xml解释 (转)
  6. POJ1298_The Hardest Problem Ever_最难的问题_Caesar 密码_C++
  7. (3)初次接触off
  8. wpf 绑定失效的原因及解决方案
  9. OpenSuSE zypper repo及Desktop媒体播放器设置 for OpenSuSE12.
  10. Linux学习netstat
  11. Get请求出现乱码的解决方案
  12. 我的Python成长之路---第二天---Python基础(8)---2016年1月9日(晴)
  13. oracle for update和for update nowait(for update wait)的区别
  14. Qt国际化相关类
  15. selenium+testN自动化测试框架搭建
  16. 根据自己的博客数据统计国内IT人群
  17. 针对Oracle的审计方案
  18. Future模式介绍及入门使用
  19. entity framework异常 The specified cast from a materialized &#39;System.Int32&#39; type to the &#39;System.String&#39; type is not valid
  20. day12-13 文件操作b模式

热门文章

  1. planAhead的启动时间较长
  2. 04-树6 Complete Binary Search Tree (30 分)
  3. planning algorithms chapter 2
  4. yarn一些最佳配置
  5. 关于event 和 window.event问题及浏览器兼容问题
  6. Http协议以及Httpclient
  7. Bert 时代的创新(应用篇):Bert 在 NLP 各领域的
  8. LiteIDE 设置默认编译输出位置
  9. g-api notes
  10. python快速搭建http服务