Instructions for V7 Pack (AppCompat) in Android

Source: Internet
Author: User

For a description of the V7 Pack (AppCompat) in Android, there is a need for friends to refer to below.

Everyone is already familiar with the V4 package, and now when you create a new Android project, the V4 package is imported by default. V7 package out not much time, with not many people, mainly to 3.0 the following version provides Actionbar support, as well as searchview,popupmenu and other control support. Because some open source frameworks have implemented support for version actionbar of 3.0, the use of the V7 package is not significant. Since Google officially provides this feature, it is also necessary to learn. Now, based on my own study and practice in the official documents, we summarize the following:

1.V7 package requires support for V4 package, V7 package is not imported by default when new Android project, v4 default import. The V7 package is under the E:\android-sdk-windows\extras\android\support path of the SDK.

The jar package provided in 2.V7 has only class files and no resource files, so you need to import android-support-v7-appcompat as a library into eclipse and refer to the project. The path to the library in the SDK is E:\android-sdk-windows\extras\android\support\v7\appcompat.

3. The new activity no longer inherits from activity, but inherits from Actionbaractivity, and also changes the operation of Actionbar. You must also add the topics in the V7 repository for the new activity, for example: Android:theme= "@style/theme.appcompat.light", without adding an error.

4. Use the class provided by v7 such as Searchview, when importing the package, be sure to select the V7 package, do not choose the SDK.

5. When adding the Searchview control in the menu, you should follow the following format strictly, otherwise you will get an error. Pay attention to the red place.

<menu xmlns:android= ""
Xmlns:yourapp= "" >


<item
Android:id= "@+id/action_settings"
android:orderincategory= "100"
Android:showasaction= "Never"
android:title= "@string/action_settings"/>
<item
Android:id= "@+id/search_view"
android:icon= "@drawable/ic_launcher"
android:orderincategory= "0"
yourapp:showasaction= "Ifroom|collapseactionview"
Yourapp:actionviewclass= "Android.support.v7.widget.SearchView"
android:title= "Search"/>


</menu>

Reference: http://www.xuebuyuan.com/1587212.html

About Appcompat_v7.jar Reference:

http://blog.csdn.net/caiwenfeng_for_23/article/details/26606817

Http://blog.sina.com.cn/s/blog_71bc26030102vbyf.html

Appcompat_v7.jar a Compatibility Pack to support Actionbar Eclipse Auto-Import

If you accidentally delete it--"http://jingyan.baidu.com/article/84b4f565c4e3e760f7da324b.html

Instructions for V7 Pack (AppCompat) in Android

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.