错误导入HoloEverywhere错误、HoloEverywhere

2023-09-11 12:35:17 作者:ぺ-奶茶也会流泪

首先,我是新与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

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

下载从GitHub上邮编到您的计算机 解压缩文件夹 转到Eclipse和选择文件&GT;新建 - &GT; Android项目 选择创建从现有的源,然后项目浏览 HoloEverywhereLib 文件夹中提取的文件夹 preSS 完成 单击新创建的项目右键,然后转到属性。 在该安卓标题,你会看到一个部分有一个复选框 IsLibrary 。确保的Checked和preSS 添加和previously添加库 ActionBarSherlock 。 Download Zip from GitHub to your computer UnZip the folder Go to eclipse and choose File->New-> Android Project Select Create project from existing source and then browse to the HoloEverywhereLib folder inside extracted folder Press Finish Right click on the newly created project and go to Properties. 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

创建一个新的Andr​​oid项目 右键单击项目 - >属性 - > Android的 - >添加,同时添加 ActionBarSherlock HoloEverywhere

更​​改 Android清单来以下 Create a new Android project Right Click on project -> Properties -> Android -> Add, add both ActionBarSherlock and HoloEverywhere

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);
    }

}