博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Using the Support Library
阅读量:4045 次
发布时间:2019-05-24

本文共 1842 字,大约阅读时间需要 6 分钟。

The Android provides a JAR file with an API library that allow you to use some of the more recent Android APIs in your app while running on earlier versions of Android. For instance, the Support Library provides a version of the APIs that you can use on Android 1.6 (API level 4) and higher.

This lesson shows how to set up your app to use the Support Library in order to use fragments to build a dynamic app UI.

Set Up Your Project With the Support Library

Figure 1. The Android SDK Manager with the Android Support package selected.

To set up your project:

  1. Downlad the Android Support package using the SDK Manager
  2. Create a libs directory at the top level of your Android project.
  3. Locate the JAR file for the library you want to use and copy it into the libs/ directory.

    For example, the library that supports API level 4 and up is located at <sdk>/extras/android/support/v4/android-support-v4.jar.

  4. Update your manifest file to set the minimum API level to 4 and the target API level to the latest release:

Import the Support Library APIs

The Support Library includes a variety of APIs that were either added in recent versions of Android or don't exist in the platform at all and merely provide additional support to you when developing specific application features.

You can find all the API reference documentation for the Support Library in the platform docs at .

Warning: To be sure that you don't accidentally use new APIs on an older system version, be certain that you import the class and related APIs from the package:

import android.support.v4.app.Fragment;import android.support.v4.app.FragmentManager;...

When creating an activity that hosts fragments while using the Support Library, you must also extend the class instead of the traditional class. You'll see sample code for the fragment and activity in the next lesson.

转载地址:http://fxgdi.baihongyu.com/

你可能感兴趣的文章
DIV/CSS:一个贴在左上角的标签
查看>>
Solr及Spring-Data-Solr入门学习
查看>>
Vue组件
查看>>
python_time模块
查看>>
python_configparser(解析ini)
查看>>
selenium学习资料
查看>>
<转>文档视图指针互获
查看>>
从mysql中 导出/导入表及数据
查看>>
HQL语句大全(转)
查看>>
几个常用的Javascript字符串处理函数 spilt(),join(),substring()和indexof()
查看>>
javascript传参字符串 与引号的嵌套调用
查看>>
swiper插件的的使用
查看>>
layui插件的使用
查看>>
JS牛客网编译环境的使用
查看>>
9、VUE面经
查看>>
关于进制转换的具体实现代码
查看>>
Golang 数据可视化利器 go-echarts ,实际使用
查看>>
mysql 跨机器查询,使用dblink
查看>>
mysql5.6.34 升级到mysql5.7.32
查看>>
dba 常用查询
查看>>