`
yidongkaifa
  • 浏览: 4050259 次
文章分类
社区版块
存档分类
最新评论

Using the Support Library

 
阅读更多

The Android Support Library 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 Fragment 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:
    <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.

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

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:

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.

分享到:
评论

相关推荐

    The C++ Standard Library 2nd 原版pdf by Josuttis

    It’s the result of many minor changes, such as using rvalue references and move semantics, range-based for loops, auto, and new template features. Thus, besides presenting new libraries and ...

    Android代码-android-RuntimePermissions

    support library and how to declare optional permissions for M-devices only. Introduction Android M introduced runtime permissions. Applications targeting M and above need to request their permissions ...

    The Busy Coder's Guide to Android Development 8.3 apk

    than using the Design Support Library and having to use appcompat-v7 *Changed a bunch of sample apps to switch from using onPause() and onResume() to using onStop() and onStart(), to be friendlier to ...

    Python Standard Library

    Python is a modular language that imports most useful operations from the standard library (basic support modules; operating system interfaces; network protocols; file formats; data conversions; ...

    The C++ Standard Library: A Tutorial and Referenc, 2nd.pdf

    It’s the result of many minor changes, such as using rvalue references and move semantics, range-based for loops, auto, and new template features. Thus, besides presenting new libraries and ...

    Android代码-about-page 2.0,全新的卡片风格

    If you are still using the android support library, please use version about:2.1.1, about-extension:2.1.1 and multitype:3.4.4. dependencies { implementation 'me.drakeet.support:about:2.2.0' ...

    Wireless Communication Library Developer VCL Edition 6.13.10.0

    The Wireless Communication Library (WCL) is the complete solution for software developers who want to add support for Bluetooth, IrDA, WiFi, WiiMote, Kinect and Serial Ports communication into their ...

    Beyond the C++ Standard Library An Introduction to Boost

    practice solutions for performing type conversions and lexical ...the C++ Standard Library &lt;br&gt;Powerful support for regular expressions with Boost.Regex &lt;br&gt;Function objects defined at the ...

    Introduction.to.Android.Application.Development(4th,2013.12) pdf

    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 ...

    NTPort Library 2.8

    NTPort Library enables your Win32 application to real-time direct access to PC I/O ports without using the Windows Drivers Development Kit(DDK) - NTPort Library provides support for Windows 95/98/ME ...

    Beyond.the.C++ - Standard.Library.An.Introduction.to.Boost

    practice solutions for performing type conversions and lexical ...the C++ Standard Library &lt;br&gt;Powerful support for regular expressions with Boost.Regex &lt;br&gt;Function objects defined at the ...

    Debenu Quick PDF Library v9.15

    Support is also included for the most common programming languages. Debenu Quick PDF Library for Windows ActiveX - ActiveX COM for Windows development supports C#, Visual C++, C++ Builder, Delphi, ...

    EhLib.VCL v10.0.035 for Delphi 7 - 10.4 Sydney by [CS].exe (25 April 2021)

    Using the library, you will receive: Maximum of enclosed functional during the work with tabular data. Time saving for developer – display your data in the right format without writing software code...

    Pro Android C++ with the NDK

    C++ Support and Standard Template Library STL Native Graphics through JNI Graphics and OpenGL ES Native Sound through OpenSL ES Profiling the native code using GProf to identify performance ...

    CommonsWare.The.Busy.Coders.Guide.to.Android.Development.Version.8.2.2017

    The Android Design Support Library Advanced Uses of WebView The Input Method Framework Fonts Rich Text Animators Legacy Animations Custom Drawables Mapping with Maps V2 Crafting Your Own Views ...

    HTML Component Library For xe10-xe101-Xe102

    HTML Component Library is a cross-patform and 100% native HTML rendering library for Delphi that brings all the power of HTML/CSS into desktop and mobile Delphi applications. Unlike other «HTML-like...

    ajaxtags标签库

    The tag library provides support for live form updates for the following use cases: autocomplete based on character input to an input field, select box population based on selections made from ...

    Programming: Principles and Practice Using C++

    Bjarne Stroustrup, "Programming: Principles and Practice Using C++"Addison-Wesley Professional | 2008 | ISBN: 0321543726 | 1272 pages | PDF | 129 MBAn Introduction to Programming by the Inventor of ...

Global site tag (gtag.js) - Google Analytics