android-support-v7包的添加
2015-08-03 19:39
316 查看
从网上摘抄下来的适用于Eclipse
Create a library project based on the support library code:
Make sure you have downloaded the Android Support Library using the SDK
Manager.
Create a library project and ensure the required JAR files are included in the project's build path:
Select File > Import.
Select Existing Android Code Into Workspace and click Next.
Browse to the SDK installation directory and then to the Support Library folder. For example, if you are adding the
Click Finish to import the project. For the v7 appcompat project, you should now see a new project titled android-support-v7-appcompat.
In the new library project, expand the
and select Build Path > Add to Build Path. For example, when creating the the v7 appcompat project, add both the
to the build path.
Right-click the project and select Build Path > Configure Build Path.
In the Order and Export tab, check the
library project. For example, the
Uncheck Android Dependencies.
Click OK to complete the changes.
You now have a library project for your selected Support Library that you can use with one or more application projects.
Add the library to your application project:
In the Project Explorer, right-click your project and select Properties.
In the Library pane, click Add.
Select the library project and click OK. For example, the
In the properties window, click OK.
Once your project is set up with the support library, here's how to add the action bar:
Create your activity by extending
Use (or extend) one of the
for your activity. For example:
Now your activity includes the action bar when running on Android 2.1 (API level 7) or higher.
On API level 11 or higher
The action bar is included in all activities that use the
(or one of its descendants), which is the default theme when either the
is set to
Create a library project based on the support library code:
Make sure you have downloaded the Android Support Library using the SDK
Manager.
Create a library project and ensure the required JAR files are included in the project's build path:
Select File > Import.
Select Existing Android Code Into Workspace and click Next.
Browse to the SDK installation directory and then to the Support Library folder. For example, if you are adding the
appcompatproject, browse to
<sdk>/extras/android/support/v7/appcompat/.
Click Finish to import the project. For the v7 appcompat project, you should now see a new project titled android-support-v7-appcompat.
In the new library project, expand the
libs/folder, right-click each
.jarfile
and select Build Path > Add to Build Path. For example, when creating the the v7 appcompat project, add both the
android-support-v4.jarand
android-support-v7-appcompat.jarfiles
to the build path.
Right-click the project and select Build Path > Configure Build Path.
In the Order and Export tab, check the
.jarfiles you just added to the build path, so they are available to projects that depend on this
library project. For example, the
appcompatproject requires you to export both the
android-support-v4.jarand
android-support-v7-appcompat.jarfiles.
Uncheck Android Dependencies.
Click OK to complete the changes.
You now have a library project for your selected Support Library that you can use with one or more application projects.
Add the library to your application project:
In the Project Explorer, right-click your project and select Properties.
In the Library pane, click Add.
Select the library project and click OK. For example, the
appcompatproject should be listed as android-support-v7-appcompat.
In the properties window, click OK.
Once your project is set up with the support library, here's how to add the action bar:
Create your activity by extending
ActionBarActivity.
Use (or extend) one of the
Theme.AppCompatthemes
for your activity. For example:
<span class="tag" style="color: rgb(0, 0, 136);"><activity</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="atn" style="color: rgb(136, 34, 136);">android:theme</span><span class="pun" style="color: rgb(102, 102, 0);">=</span><span class="atv" style="color: rgb(0, 136, 0);">"@style/Theme.AppCompat.Light"</span><span class="pln" style="color: rgb(0, 0, 0);"> ... </span><span class="tag" style="color: rgb(0, 0, 136);">></span>
Now your activity includes the action bar when running on Android 2.1 (API level 7) or higher.
On API level 11 or higher
The action bar is included in all activities that use the
Theme.Holotheme
(or one of its descendants), which is the default theme when either the
targetSdkVersionor
minSdkVersionattribute
is set to
"11"or higher. If you don't want the action bar for an activity, set the activity theme to
Theme.Holo.NoActionBar.
相关文章推荐
- MyEclipse Web Project转Eclipse Dynamic Web Project
- Windows Clang开发环境备忘
- 让Flex Builder 3.0与Eclipse3.4整合起来
- Eclipse配置Javascript开发环境图文教程
- 使用zend studio for eclipse不能激活代码提示功能的解决办法
- ext for eclipse插件安装方法
- 解决Fedora14下eclipse进行android开发,ibus提示没有输入窗口的方法详解
- eclipse导入jquery包后报错的解决方法
- Eclipse 格式化代码时不换行与自动换行的实现方法
- Eclipse下jQuery文件报错出现错误提示红叉
- eclipse如何忽略js文件报错(附图)
- eclipse3.2.2 + MyEclipse5.5 + Tomcat5.5.27 配置数据库连接池
- jquery库或JS文件在eclipse下报错问题解决方法
- 什么是eclipse,eclipse的意思解析
- Zend Studio for Eclipse的java.lang.NullPointerException错误的解决方法
- eclipse+myeclipse 环境配置方法
- 基于eclipse.ini内存设置的问题详解
- java,Android:在eclipse中的快捷键(经典收藏)
- 解析Java和Eclipse中加载本地库(.dll文件)的详细说明
- 探讨如何在Eclipse中过滤版本控制文件.svn