原文地址:https://developer.android.com/training/basics/fragments/support-lib.html
------------------------------------------------------------------------------------------------------------------
The Android Support Library provides a JAR file
with an API library that allows 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
Fragment
APIs that you can use on Android 1.6 (API level 4) and higher.
Android Support Library提供了一个JAR文件,里面包含了一个API库,它允许你在你的app中使用一些较新的Android
APIs,以便运行在较早版本的Android系统上。例如,Support Library提供了一个版本Fragment接口,你可以在Android
1.6(APL level 4)或更高版本系统上使用。
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.
这节课向你展示了如何使用Support Library设置你的app,以便利用框架建立一个动态的app UI。
Set Up Your Project with the Support Library —— 利用支持库建立你自己的项目
To set up your project:
- Download the Android Support package using the SDK Manager.
- Create a
libs
directory at the top level of your Android project.
-
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
.
-
Update your manifest file to set the minimum API level to
4
and the target API level to the latest release: <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="15" />
为了建立你的项目:
- 使用SDK Manager下载Android Support包。
- 在你的Android项目的顶层目录下创建一个libs目录。
- 找到你想要使用的JAR文件,然后把它粘贴到 libs/ 目录下。例如,只是API level 4及其以上的库位于<sdk>/extras/android/support/v4/android-support-v4.jar。
-
设置最低的API level值为4,目标API level为最新发布版本,更新你的清单文件:
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="15" />
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.
Support Library包含了一系列编程接口,它们要么是在最新的Android系统中添加进来的,要么根本不存在平台上,而仅仅是在你开发特殊应用特性时提供额外的支持。
You can find all the API reference documentation for the Support Library in the platform docs at
android.support.v4.*
.
你可以在android.support.v4.*找到Support Library的API参考文档。
Warning: To be sure that you don't accidentally use new APIs on an older system version, be certain that you import the
Fragment
class and related APIs from the
android.support.v4.app
package:
警告:请确保你没有在较老的系统版本上意外地使用新的APIs,确认你从android.support.v4.app包中导入了Fragment类及其相关的APIs:
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
FragmentActivity
class instead of the traditional
Activity
class. You'll see sample code for the fragment and activity in the next lesson.
当你使用Support Library创建一个持有框架的activity时,你必须同时扩展FragmentActivity类,而不是传统的Activity类。你将会在下一节课看到有关框架的实例代码。
分享到:
相关推荐
它拥有自己的生命周期,接受它自己的输入事件,你也可以在运行activity的时候添加或者移除它(有点像“子activity”你可以在不同的activity中重用) 这节课演示怎么样使用Support Library继承Fragment类,如此你的app...
使用Fragment如何创建高性能UI;使用Fragment如何创建高性能UI
Trying to meet these demands using Android's traditional activity-centric UI design model is difficult at best. As developers, we need more control than that afforded by activities. We need a new ...
Create engaging apps with fragments to provide a rich user interface that dynamically adapts to the individual characteristics of your customers' tablets and smartphones About This Book From an ...
对目标进行分多个块,利用积分直方图进行计算,用EMD比较,该方法能够对目标出现部分遮挡进行很好的跟踪
Long gone are the days of the mobile apps with a static UI squished onto a tiny screen. Today's users expect mobile apps to be dynamic and highly interactive. They expect an app to look fantastic when...
基于Android框架的动态UI构建(Creating Dynamic UI with Android Fragments, 2nd Edition)-2016英文原版,0积分——该书是2016年最新的第2版,全书154页。
Long gone are the days of mobile apps with a static UI squished on a tiny screen. Today's users expect mobile apps to be dynamic and highly interactive. They expect an app to look fantastic when they ...
Robust fragments-based tracking with adaptive feature selection
nested-fragments-master
Understand the basics of using fragments and how to use them to create more adaptive and dynamic user experiences ☆ 出版信息:☆ [作者信息] Jim Wilson [出版机构] Packt Publishing [出版日期] 2013...
资源来自pypi官网。 资源全名:Agora-Fragments-0.1.1.tar.gz
android的不断革新,是android的UI控件更加的人性化,Building a Dynamic UI with Fragments,动态的UI更加的增强了界面的交互
Multi-Scale Categorical Object Recognition Using Contour Fragments
官方版本,亲测可用
官方版本,亲测可用
官方版本,亲测可用
This script allows you to brake apart the render into fragments, in such way that the RAM of the PC doesn´t limit the size of the final image. In this version it´s included an option "beta" that ...
Leveraging the Android Support Library 335 Supporting Specific Screen Types 335 Working with Nine-Patch Stretchable Graphics 336 Using the “Working Square” Principle 336 Providing Alternative ...
Creating Dynamic UI with Android Fragments Leverage the power of Android Fragments to develop dynamic user interfaces for your apps