1
工作時我嘗試使用HoloEverywhere與我的設置活動我在logcat中得到這個錯誤:HoloEverywhere不在應用
10-26 09:56:59.653: E/AndroidRuntime(3552): android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
10-26 09:56:59.653: E/AndroidRuntime(3552): at com.WazaBe.HoloEverywhere.LayoutInflater.onCreateView(LayoutInflater.java:195)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
10-26 09:56:59.653: E/AndroidRuntime(3552): at com.WazaBe.HoloEverywhere.preference.Preference.onCreateView(Preference.java:514)
10-26 09:56:59.653: E/AndroidRuntime(3552): at com.WazaBe.HoloEverywhere.preference.Preference.getView(Preference.java:404)
10-26 09:56:59.653: E/AndroidRuntime(3552): at com.WazaBe.HoloEverywhere.preference.PreferenceGroupAdapter.getView(PreferenceGroupAdapter.java:158)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.AbsListView.obtainView(AbsListView.java:1430)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.ListView.makeAndAddView(ListView.java:1745)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.ListView.fillDown(ListView.java:670)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.ListView.fillFromTop(ListView.java:727)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.ListView.layoutChildren(ListView.java:1598)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.AbsListView.onLayout(AbsListView.java:1260)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.View.layout(View.java:7175)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.View.layout(View.java:7175)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1243)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.LinearLayout.onLayout(LinearLayout.java:1049)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.View.layout(View.java:7175)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.View.layout(View.java:7175)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.View.layout(View.java:7175)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.View.layout(View.java:7175)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.View.layout(View.java:7175)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.View.layout(View.java:7175)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.ViewRoot.performTraversals(ViewRoot.java:1140)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.os.Handler.dispatchMessage(Handler.java:99)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.os.Looper.loop(Looper.java:130)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.app.ActivityThread.main(ActivityThread.java:3683)
10-26 09:56:59.653: E/AndroidRuntime(3552): at java.lang.reflect.Method.invokeNative(Native Method)
10-26 09:56:59.653: E/AndroidRuntime(3552): at java.lang.reflect.Method.invoke(Method.java:507)
10-26 09:56:59.653: E/AndroidRuntime(3552): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-26 09:56:59.653: E/AndroidRuntime(3552): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-26 09:56:59.653: E/AndroidRuntime(3552): at dalvik.system.NativeStart.main(Native Method)
10-26 09:56:59.653: E/AndroidRuntime(3552): Caused by: java.lang.reflect.InvocationTargetException
10-26 09:56:59.653: E/AndroidRuntime(3552): at java.lang.reflect.Constructor.constructNative(Native Method)
10-26 09:56:59.653: E/AndroidRuntime(3552): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
10-26 09:56:59.653: E/AndroidRuntime(3552): ... 46 more
10-26 09:56:59.653: E/AndroidRuntime(3552): Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x2
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:463)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.View.<init>(View.java:2108)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.View.<init>(View.java:1899)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.view.ViewGroup.<init>(ViewGroup.java:286)
10-26 09:56:59.653: E/AndroidRuntime(3552): at android.widget.LinearLayout.<init>(LinearLayout.java:120)
10-26 09:56:59.653: E/AndroidRuntime(3552): at com.WazaBe.HoloEverywhere.widget.LinearLayout.<init>(LinearLayout.java:37)
10-26 09:56:59.653: E/AndroidRuntime(3552): at com.WazaBe.HoloEverywhere.widget.LinearLayout.<init>(LinearLayout.java:33)
10-26 09:56:59.653: E/AndroidRuntime(3552): ... 49 more
我從溢出菜單項開始我settingsActivity。我可以爲HoloEverywhere-Demo添加一個溢出菜單,並在選擇時啓動我的活動並且它可以正常工作。這裏是我的設置活動:
public class SettingsActivity extends com.WazaBe.HoloEverywhere.sherlock.SPreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.settings);
}
@Override
public void onStart() {
super.onStart();
initActionBar();
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void onPause() {
super.onPause();
}
@Override
public void onStop() {
super.onStop();
}
private void initActionBar() {
ActionBar actionBar = getSupportActionBar();
actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.action_bar_gradient));
actionBar.setTitle(R.string.settings);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayUseLogoEnabled(true);
}
}
任何想法,爲什麼我可以使用在演示這個活動沒有任何問題,但是當我添加到我的申請,我得到我張貼的錯誤?
完美。出色地工作。 –