zoukankan      html  css  js  c++  java
  • 【Android】完善Android学习(五:API 3.2)

    备注:之前Android入门学习的书籍使用的是杨丰盛的《Android应用开发揭秘》,这本书是基于Android 2.2API的,目前Android已经到4.4了,更新了很多的API,也增加了很多的新组件,一直没有系统的学习过。现在开始这个“完善Android学习”系列,将2.2以后的新知识做一个概览。概览来自:http://developer.android.com/about/versions/android-3.2.html

    Android3.2(HONEYCOMB_MR2)是为用户和开发者添加新功能的增发版本。下面将会对该版本的新特性做一个概览。

    Platform Highlights

    New user Featrue

    1)为大量平板做出的优化;

    2)固定尺寸的应用放大特性:主要针对一些不是为大屏设别设计的app提供compatibility zoom mode,用户可以在system bar上找到该menu;

    3)从SD卡同步媒体文件;

    New developer feature

    1)屏幕管理支持的扩展API;

    API Overview

    Screen compatibility mode

    Android 3.2为应用提供了一中心的screen compability mode,这个模式允许开发者显示声明应用不支持正在运行的那么大的屏幕,从而系统会在一个比较小的屏幕区域内渲染应用,然后放大像素,让应用适应当前的屏幕。

    缺省状态下,系统会让用户选择是否使用该模式,只对需要的应用启用这个模式。用户可以在system bar上关闭或者开启这个模式;

    因为这个模式不是对所有的应用都适用,开发者可以在Manifest文件中禁止该模式的使用,当在应用中禁止该模式之后,app在运行的时候系统就不会为它提供这个模式选项。

     

    UI framework

    1)Fragment

        新的Fragment.SaveState类,可以保留方法saveFragmentInstanceState()中取出的fragment状态;

        新的方法saveFragmentInstanceState():可以保存给定的Fragment的状态,这个状态在之后新建Fragment的实例的时候可以被使用来恢复状态;

        新的方法serInitialSavedState():当Fragment新建的时候用于设置初始的被保存的状态;

        新的方法onViewCreated():毁掉方法,在onCreateView()方法执行完毕返回,而其余任何的保存的状态恢复到界面上之前;

        方法isDetached()被用来检测Fragment是否被明确的从UI界面上移除了;

        新的attach()和detach()方法:可以让应用在UI上重新挂载或者移除一个fragment;

        新的重载方法setCustomAnimators():让开发者可以明确的指定fragment进入/退出和从back stack弹出的时候的动画资源文件;

    2)Helpers for getting display size from WindowManager

    新的方法getSize()和getRectSize()让应用可以获得展示的原始尺寸

    3)新的公开的holographic style

    4)LocalActivityManager,ActivityGroup被废弃了。

    新的应用应该使用Fragment来替代这些类,老版本的应用想要运行在这个平台上,就需要v4 Support Library,这个库可以让Fragment往前推到Android1.6(API Level 4).

    对于在3.0或者更高版本上开发的应用,tabs通常使用方法ActionBar.newTab()来实例化以及相关的方法添加到action bar中。

    Media framework

    使用media provider(MediaStore)的应用现在可以直接从可移除的SD卡上读取媒体数据了,应用也可以用MTP API直接和SD卡上的文件交互了。

    Graphics

    1)Parcelable utilities in Point and PointF

    Ponit和PointF类现在已经实现了Parcelable接口,并且增加了新的方法describeConmtents(),readFormParcel()和writeToParcel()

    IME framework

    New getModifiers() method for retrieving the current state of the modifier keys.

    USB framework

    新的方法getRawDescriptor()方法来获取设备的原始USB描述符。

    Network

    1)Network type constants

    ConnectivityManage添加了新的常量:TYPE_ETHERNET和TYPE_BLUETOOTH

    Telephony

    新的NETWORK_TYPE_HSPAP网络配型常量

    Core urilities

    1)Parcelabe utilities

        新的接口Parcelable.ClassLoaderCreator允许应用在对象正被创建的时候接收ClassLoader;

        新的方法adoptFd,dup()和fromFd()用来管理ParcelFileDescriptor对象;

    2)Binder and IBinder

    New method dumpAsync() in Binder and IBinder let applications dump to a specified file, ensuring that the target executes asynchronously.

    New IBinder protocol transaction code TWEET_TRANSACTION lets applications send a tweet to the target object.

    New Feature constants

    这个平台添加了新的可以Manifest文件中使用的硬件特征常量。

    1)Feature constants for landscape or portrait requirements

    指明应用是否要求横竖屏,如果设备不允许特定的方式,则应用不能安装,如果应用没有声明或者声明了两者,则说明应用不关心这个。

    android.hardware.screen.landscape — The application requires display in landscape orientation.

    android.hardware.screen.portrait — The application requires display in portrait orientation.

    2)Other feature constants

    android.hardware.faketouch.multitouch.distinct — The application requires support for emulated mulitouch input with distinct tracking of two or more points.

    android.hardware.faketouch.multitouch.jazzhand — The application requires support for emulated mulitouch input with distinct tracking of five or more points.

  • 相关阅读:
    怎样让一个div高度自适应浏览器高度
    angular change the url , prevent reloading
    论习惯的重要性
    php的几个内置的函数
    cakephp 2.0 源码解读(一)
    svn switch 的用法
    浏览器兼容问题 及 解决方案 (一)
    浏览器兼容问题 及 解决方案 (二)
    promise 承诺
    ng-selected 与ng-options的使用
  • 原文地址:https://www.cnblogs.com/lqminn/p/3480348.html
Copyright © 2011-2022 走看看