如何使用ActionBarActivity而不是Activity [英] How to work with ActionBarActivity instead of Activity

查看:117
本文介绍了如何使用ActionBarActivity而不是Activity的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用eclipse进行android开发,最后一次在几个月前用API-17。但是今天从SDK管理器安装新的更新时,我正在尝试创建一个新的项目。在创建之后,我的活动扩展了ActionBarActivity而不是活动。并显示错误。任何解决方案



Plus我得到以下2行导入显示错误:

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

解决方案

将AppCompat库导入Eclipse(您可能需要从SDK中下载它经理人) ActionBarActivity与正常的Activity相同,除了一些方法名称稍有不同,例如 getSupportActionBar()而不是 getActionBar() getSupportFragmentManager()而不是 getFragmentManager()


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?

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

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

解决方案

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().

这篇关于如何使用ActionBarActivity而不是Activity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆