如何使用ActionBarActivity,而不是活动工作如何使用、而不是、工作、ActionBarActivity

2023-09-07 01:50:26 作者:傲影

我使用Eclipse进行Android开发,也是最后一次我和API-17用它几个月前。但今天从安装SDK管理器的新更新的时候,我试图创建一个新项目。与创新后,我的活动,而不是扩大活动的ActionBarActivity。而它的显示错误。任何解决方案?

I am using eclipse for android development and last time I used it couple of months ago with API-17. But today when installing new updates from SDK manager, I am trying to create a new project. And after creation my activity is extending ActionBarActivity instead of activity. And its showing errors. Any solutions?

另外,我得到了下面的2线进口示值误差的:

Plus I got the below 2 lines of importing showing error:

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

推荐答案

导入应用程序兼容性库到Eclipse(您可能需要首先从SDK管理器中下载)。 ActionBarActivity工作一样的正常活动,除了一些方法名称稍有不同,例如 getSupportActionBar()而不是 getActionBar() getSupportFragmentManager() getFragmentManager()

Import the AppCompat library into Eclipse (you may have to download it from the SDK Manager first). ActionBarActivity works the same as a normal Activity, except some method names are slightly different, e.g. getSupportActionBar() instead of getActionBar() and getSupportFragmentManager() instead of getFragmentManager().