Ale*_*s95 14 android themes actionbarsherlock android-holo-everywhere
首先,我是Android新手.我正在做一个应用程序,我正在实现一个名为HoloEverywhere的库.这个库在themes.xml中使用了ActionBar Sherlock库.我已导入到我的工作区ActionBar Sherlock,我已将其添加到HoloEverywhere.接下来,我已将HoloEverywhere添加到我的项目中,但是当我尝试使用它时,我有一个错误(我尝试使用按钮):
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.
Run Code Online (Sandbox Code Playgroud)
我把类的路径放在我的布局中,如下所示:
<com.WazaBe.HoloEverywhere.ButtonHolo
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/text" />
Run Code Online (Sandbox Code Playgroud)
我如何解决这个问题并在我的项目中使用这个库?谢谢:) PS.对不起我的英语,我知道这不是很好.
Gau*_*wal 40
按照以下步骤(取自此处的博客)添加ActionBarSherlock
File->New-> Android Project Create project from existing source,然后browse到library提取的文件夹里面AndroidBarSherlock的文件夹Finish Properties.Android标题下,您应该看到一个Library带有复选框的部分IsLibrary.确保已选中.AndroidBarSherlock 在Android标题下Library选择要添加的项目的属性,然后选择该部分Add.ActionBarSherlock库,将其添加到您的项目中按照以下步骤添加HoloEverywhere
File->New-> Android Project Create project from existing source,然后browse到HoloEverywhereLib解压文件夹内的文件夹Finish Properties.Android标题下,您应该看到一个Library带有复选框的部分IsLibrary.确保已选中并按下Add以前添加的库ActionBarSherlock.请按照以下步骤添加HoloEverywhere到您的项目中
ActionBarSherlock和HoloEverywhereAndroid Manifest将以下内容更改为
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Holo.Theme">
编辑您main.xml包括Holo主题小部件.
改变你activity的如下
public class ChkActionBarSherlock extends SherlockActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
Run Code Online (Sandbox Code Playgroud)看起来
android:theme="@style/Theme.HoloEverywhereDark.Sherlock"
Run Code Online (Sandbox Code Playgroud)
导致错误.
更改:
android:theme="@style/Holo.Theme"
Run Code Online (Sandbox Code Playgroud)
在这里:
正确!
| 归档时间: |
|
| 查看次数: |
12694 次 |
| 最近记录: |