How to add support libraries?

给你一囗甜甜゛ 提交于 2019-11-27 03:36:33

问题


I added android-support-v7-appcompat. Next I clicked on each file in directory \libs. Then I clicked android-support-v7-appcompat and opened properties. Next checked files from directory libs and unchecked Android Dependencies. Next opened properties of myproject. Went to the projects and by Add button added android-support-v7-appcompat.

But nothing is working. How can I make ActionBarActivity(there is no new variants) and how can I add a theme. I used to add in manifest to activity, tried to add it to the style.xml


回答1:


I solved my problem. It was hard to me to find add Library button.

I acted in wrong way. It is below.

and here is a correct way.




回答2:


Documentation for the new backwards-compatible ActionBar is at http://developer.android.com/guide/topics/ui/actionbar.html

To install the necessary library, follow the instructions at http://developer.android.com/tools/support-library/setup.html

Follow the instructions closely. You need the appcompat library, but the classes themselves are in android.support.v7.app.




回答3:


But nothing is working. How can I make ActionBarActivity(there is no new variants)

This document is quite dense if English is not your first language. So these are the key steps from the "Adding libraries with resources" section of http://developer.android.com/tools/support-library/setup.html

1) Add support library WITH RESOURCES (file ...import ... android ... existing android code into workspace)

2) Check it is defined as a library project (properties .. android ... isLibrary checked), then REFERENCE it in your application project (properties .. android ... reference ... add)

3) Then in the library project - right clicked on each of the jar files in libs and do (build path ... add to build path)

4) Then FOR THE LIBRARY PROJECT do right click ...( build path ... configure build path ... order and export ...) check both of these libraries and unchecked android dependencies

At this point, your android-support-v7-appcompat library project should contain no errors. You should also be able to use ActionBarActivity in your project and things like android:theme="@style/Theme.AppCompat.Light" in your manifest.

I used to add in manifest to activity, tried to add it to the style.xml

You should not now need to add style.xml to your project - it will be picked up from the referenced library project. I suggest you confirm all this is working before you proceed to http://developer.android.com/guide/topics/ui/actionbar.html



来源:https://stackoverflow.com/questions/17891622/how-to-add-support-libraries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!