ListActivity与动作条支持V7 [英] ListActivity with ActionBar support v7

查看:169
本文介绍了ListActivity与动作条支持V7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的主要活动扩展ListActivity,现在我要实现与支持的动作条的旧版本。

My main Activity extends ListActivity, and now I have to implement an ActionBar with support for older versions.

我已经readed有关的方法可以做到这一点,我决定尝试这种方式:

I have readed about the ways to do this, and I decided to try this way:

我下载ListActivity源$ C ​​$ C,我修改了一些事情,现在我需要在这里实现了动作条,所以我想这个活动扩展到ActionbarActivity。这样一来,我将有一个自定义的ActionBarListActivity,我可以延长我的活动这个自定义类,有ListActivity和动作条的话的功能。

这些都是我做的步骤:

  • 添加支持V7库到我的项目
  • 设置为aplications主题@样式/ Theme.AppCompat

但是,当我试图延长活动ActionBarActivity,不让我这样做,它说ActionbarActivity不能被解析为一个类型,并建议修改它动作条(android.app)。我知道我不得不进口进口android.support.v7.app.ActionBarActivity,但它不会让我这样做。

But when I'm trying to extend the activity to ActionBarActivity, doesn't let me do this, it says "ActionbarActivity cannot be resolved to a type" and suggest to change it for 'ActionBar'(android.app). I know I have to import the "import android.support.v7.app.ActionBarActivity" but it doesn't let me do this.

那么,到底是怎么回事错在这里?

So, what is going wrong here?

推荐答案

这听起来并不像你进口的图书馆权利特别。

It does not sound like you imported the library right especially.

在Eclipse中,你需要为右键单击该项目,转到属性,在列表中选择的Andr​​oid和添加可添加库

in eclipse you need to right click on the project, go to Properties, select Android in the list then Add to add the library

按照本教程中的文档

http://developer.android.com/tool​​s/support-library/ setup.html

更新:

试试这个:

  • 导入支持库作为一个项目从SDK /演员/安卓/支持/ V7 / appcompat

在你的项目参考库(用于Eclipse,属性 - 机器人 - 添加)。

Reference library in your project (for Eclipse, "Properties - Android - Add").

构建项目(为Eclipse,项目 - 全部构建)。请确保您有android.support.v7.appcompat在主项目根文件夹。

Build projects (for Eclipse,"Projects - Build All"). Make sure, you have "android.support.v7.appcompat"in your main project gen folder.

如果仍然不能解决你的问题,重新启动Eclipse。

If it still doesn't solve your problem, restart eclipse.

那么干净和改造项目

如果问题仍然存在,从您的计算机中删除的支持库,并重新下载它,并按照上述步骤。

If the problem persists, remove the support library from you computer and redownload it and follow above mentioned steps.

这篇关于ListActivity与动作条支持V7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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