本文介绍了错误导入HoloEverywhere的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我是新与Android。我做一个应用程序,和我实现了一个名为 HoloEverywhere 库。这在的themes.xml库中的ActionBar福尔摩斯库的使用。我已经导入到我的工作区的ActionBar福尔摩斯,我已经把它添加到HoloEverywhere。接下来,我已经加入HoloEverywhere到我的项目,但是当我尝试使用它,我有一个错误(我试图用一个按钮):

First of all, I am new with Android.I am doing an app, and I am implementing a library called HoloEverywhere.This library use in the themes.xml the library ActionBar Sherlock. I have imported to my workspace ActionBar Sherlock and I have added it to HoloEverywhere.Next, I have added HoloEverywhere to my project, but when I try to use it, I have an error (I tried to use a button):

The following classes could not be instantiated:
- com.WazaBe.HoloEverywhere.ButtonHolo (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.
Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse.

我把我的布局类的路径,像这样的:

I put the path of the class in my layout, like this:

<com.WazaBe.HoloEverywhere.ButtonHolo
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/text" />

我怎么能解决这个问题,使用该库在我的项目?谢谢 :)PS。对不起,我的英语水平,我知道这是不是很好。

How I can solve this problem and use this library in my project?. Thanks :)PS. Sorry for my english, I know it is not very good.

推荐答案

按照以下(从博客采取的)添加 ActionBarSherlock

Follow the steps below(taken from blog here) to add ActionBarSherlock

  1. 下载的.zip / .tgz的并提取
  2. 转到Eclipse和选择文件&GT;新建 - &GT; Android项目
  3. 选择创建从现有的源,然后项目浏览文件夹中提取 AndroidBarSherlock 文件夹
  4. 在构建目标应是最新(14或15),但是你的minSdkVersion可以少(7或8)
  5. preSS 完成
  6. 单击新创建的项目右键,然后转到属性
  7. 在该安卓标题,你会看到一个部分有一个复选框 IsLibrary 。确保的Checked。
  8. 右键单击 - 对项目>性的判定中,要添加 AndroidBarSherlock 安卓标题和部分选择添加
  9. 您应该看到 ActionBarSherlock 库,添加到您的项目
  10. 最后,如果你使用的的兼容性支持的,你需要删除的的,因为它包含在ActionBarSherlock。
  1. Download the .zip/.tgz and extract it
  2. Go to eclipse and choose File->New-> Android Project
  3. Select Create project from existing source and then browse to the library folder inside extracted AndroidBarSherlock folder
  4. Build Target should be the latest(14 or15), but your minSdkVersion can be less (7 or 8)
  5. Press Finish
  6. Right click on the newly created project and go to Properties.
  7. Under the Android heading, you should see a section for Library with a checkbox IsLibrary. Make sure that's checked.
  8. Right click -> Properies on the project in which you wish to add AndroidBarSherlock under the Android heading and the Library section choose Add.
  9. You should see the ActionBarSherlock library, add this to your project
  10. Lastly, if you were using the compatibility support , you need to delete that jar since it's included in ActionBarSherlock.

按照以下步骤添加 HoloEverywhere

Follow the steps below to add HoloEverywhere

  1. 下载从GitHub上邮编到您的计算机
  2. 解压缩文件夹
  3. 转到Eclipse和选择文件&GT;新建 - &GT; Android项目
  4. 选择创建从现有的源,然后项目浏览 HoloEverywhereLib 文件夹中提取的文件夹
  5. preSS 完成
  6. 单击新创建的项目右键,然后转到属性
  7. 在该安卓标题,你会看到一个部分有一个复选框 IsLibrary 。确保的Checked和preSS 添加和previously添加库 ActionBarSherlock
  1. Download Zip from GitHub to your computer
  2. UnZip the folder
  3. Go to eclipse and choose File->New-> Android Project
  4. Select Create project from existing source and then browse to the HoloEverywhereLib folder inside extracted folder
  5. Press Finish
  6. Right click on the newly created project and go to Properties.
  7. Under the Android heading, you should see a section for Library with a checkbox IsLibrary. Make sure that's checked and press Add and previously added library ActionBarSherlock.

按照以下步骤添加 HoloEverywhere 到项目

Follow these steps to add HoloEverywhere to your project

  1. 创建一个新的Andr​​oid项目
  2. 右键单击项目 - >属性 - > Android的 - >添加,同时添加 ActionBarSherlock HoloEverywhere
  3. 更​​改 Android清单来以下

  1. Create a new Android project
  2. Right Click on project -> Properties -> Android -> Add, add both ActionBarSherlock and HoloEverywhere
  3. Change the Android Manifest to following

&lt;应用                 机器人:图标=@可绘制/ ic_launcher                 机器人:标签=@字符串/ APP_NAME                 机器人:主题=@风格/ Holo.Theme&GT;

<application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/Holo.Theme">

编辑您的main.xml 来包括全息主题的部件。

Edit you main.xml to include Holo theme widgets.

更​​改活动如下:

public class ChkActionBarSherlock extends SherlockActivity {
    @Override
     public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

}

这篇关于错误导入HoloEverywhere的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 09:22