[英]ActionBar in Android Maven Project using Android Support Library v7
I have a Android Maven project and am having difficulties to maintain compatibility using ActionBar. 我有一个Android Maven项目,并且很难使用ActionBar维护兼容性。
Before I was using ActionBarSherlock , but I saw that Google released the v7 support library would have the same goal. 在我使用ActionBarSherlock之前,我看到谷歌发布的v7支持库将有相同的目标。 I decided to remove the dependence of ActionBarSherlock and use v7.
我决定删除ActionBarSherlock的依赖并使用v7。 I've tried several ways:
我尝试了几种方法:
Has anyone set up an android project with library support v7 using Maven? 有没有人使用Maven设置一个带有库支持v7的android项目? Could you help me please?
请问你能帮帮我吗?
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 在2.2设备中实现ActionBar和2.2中的ViewPager,Framgmet Tag等其他功能,然后使用sherlockActionbar和AppCompat两种方式
Sherlock is and third party library while AppCompat is Android library. Sherlock是第三方库,而AppCompat是Android库。
step to use AppCompact in project 步骤在项目中使用AppCompact
just update android skd-> extra-> Android support library 只需更新android skd-> extra-> Android支持库
Then goto you sdk in your system-> Androidsdk\\extras\\android\\support\\v7 find appcompat source code. 然后转到你的系统中的sdk-> Androidsdk \\ extras \\ android \\ support \\ v7找到appcompat源代码。 Import this appcompact in you eclipse.
在你的eclipse中导入这个appcompact。
Create you project and select appcompact library from property->android-> Library. 创建项目并从property-> android-> Library中选择appcompact库。
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 ` 打开你的表现文件并更改主题
**android:theme="@style/Theme.AppCompat.Light**"
然后用ActionBarActivity
扩展你的活动,如果你找不到它然后请manualy **android:theme="@style/Theme.AppCompat.Light**"
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBar.Tab;
import android.support.v7.app.ActionBarActivity;`
Then Add below code to activity 然后将以下代码添加到活动中
final ActionBar actionBar = getSupportActionBar();
actionBar.setHomeButtonEnabled(false);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.