动作条在Android的Maven项目采用了Android支持库V7采用了、动作、项目、Maven

2023-09-06 06:09:59 作者:奈何桥的轮回ゝ

我有一个Android的Maven项目时遇到困难,用动作条,以保持兼容性。

I have a Android Maven project and am having difficulties to maintain compatibility using ActionBar.

在我使用的 ActionBarSherlock ,但我看到,谷歌发布了 V7支持库也有同样的目标。我决定删除ActionBarSherlock和使用V7的依赖。我试过几种方式:

Before I was using ActionBarSherlock, but I saw that Google released the v7 support library would have the same goal. I decided to remove the dependence of ActionBarSherlock and use v7. I've tried several ways:

1 - 导入文件夹Android的SDK \演员\机器人\ SUPPORT \ V7 \ appcompat作为Eclipse IDE的一个现有的Andr​​oid code到工作区,并注册了他的图书馆。但该项目停止标识由框架AndroidAnnotations生成的类。例如LoginActivity _ 2 - 添加使用显示此问题仓库行家appcompat-V7的依赖。但我无法使项目编译,甚至还试图依赖的不同配置。 1 - Import the folder "android-sdk\extras\android\support\v7\appcompat" as a "Existing Android Code into Workspace" on Eclipse IDE and registered him as Library. But the project stopped identifying the classes generated by the framework AndroidAnnotations. For example LoginActivity_ 2 - Adding maven appcompat-v7 dependency using the repository showing this question. But I could not make the project compile, even trying different configurations of dependence.

有没有人设置了V7使用Maven库支持的Andr​​oid项目?你能帮助我吗?

Has anyone set up an android project with library support v7 using Maven? Could you help me please?

推荐答案

执行动作条在2.2设备和其他Functionlity像ViewPager,Framgmet标签在2.2再有就是利用sherlockActionbar和AppCompat双向

Implement ActionBar in 2.2 device and other Functionlity like ViewPager,Framgmet Tag in 2.2 then there is two way using sherlockActionbar and AppCompat

福尔摩斯是和第三方库,而AppCompat的是Android库。照片的步骤使用AppCompact项目 刚更新的Andr​​oid skd->预算外> Android的支持库 然后转到你在你的系统 - > Androidsdk \演员SDK \机器人\ SUPPORT \ V7找到appcompat源$ C ​​$ C。在你Eclipse导入这个appcompact。 创建你的项目,然后从财产─> android->图书馆appcompact库。 打开你manifeast文件,更改主题 **安卓主题=@风格/ Theme.AppCompat.Light ** 然后扩展与 ActionBarActivity 您的活动,如果你不能找到它,然后请manualy进口`

Sherlock is and third party library while AppCompat is Android library.step to use AppCompact in project just update android skd-> extra-> Android support libraryThen goto you sdk in your system-> Androidsdk\extras\android\support\v7 find appcompat source code. Import this appcompact in you eclipse. Create you project and select appcompact library from property->android-> Library. open you manifeast file and change theme **android:theme="@style/Theme.AppCompat.Light**" Then extend your activity with ActionBarActivity if you cannot found it then pls manualy import `

 import android.support.v7.app.ActionBar;
 import android.support.v7.app.ActionBar.Tab;
 import android.support.v7.app.ActionBarActivity;`

然后添加以下code到活动

Then Add below code to activity

final ActionBar actionBar = getSupportActionBar();
actionBar.setHomeButtonEnabled(false);