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
To set up your project:
- Downlad 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" />
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.
分享到:
相关推荐
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 ...
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 ...
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 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; ...
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 ...
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' ...
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 ...
practice solutions for performing type conversions and lexical ...the C++ Standard Library <br>Powerful support for regular expressions with Boost.Regex <br>Function objects defined at the ...
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 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 ...
practice solutions for performing type conversions and lexical ...the C++ Standard Library <br>Powerful support for regular expressions with Boost.Regex <br>Function objects defined at the ...
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, ...
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...
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 ...
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 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...
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 ...
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 ...