现在的位置: 首页 > 综合 > 正文

How:android 1.6版本兼容使用ListFragment思想要点

2013年05月07日 ⁄ 综合 ⁄ 共 924字 ⁄ 字号 评论关闭

一、类库支持:

      1.必要文件:android-support-v4.jar

文件介绍:The Support Package includes static "support libraries" that you can add to your Androidapplication in order to use APIs that are either not available for older      platform versions or thatoffer "utility" APIs that aren't a part of the framework APIs.
The goal is to simplify yourdevelopment by offering more APIs that you can bundle with your application so you canworry less about platform versions.

      2.如何获取该库:启动SDK Manager->选中Repository->找到并选中Android Compatibility package->点击安装等待完成,截图如下:

     

      完成后可在 <sdk>extras/android/compatibility/v4 目录下找到android-support-v4.jar

    3.如何在自己的android应用开发项目中使用该库:

     

二、代码编写要点:

    1.实现一个fragment的一般组成:

        1.1.res/layout 目录下布局中添加fragment元素,例如:

       

        1.2.fragment对应类实现,例如:

       

        1.3.修改setContentView(),布局实参,例如:

       

        1.4.其余相关模块实现

        1.5.注意事项:含有fragment的Activity要从FragmentActivity继承,该类位置是android.support.v4.app.FragmentActivity

三、该问题相关资源

    1.本文实例源代码

    2.类库解说官方链接

    3.FragMent文档官方链接

抱歉!评论已关闭.