How to resolve this error: ClassCastException: com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup
If this is the wrong place to ask this question, please direct me to a more appropriate loc开发者_运维技巧ation.
I am working on an Android project in Eclipse. When I attempt to view the Preference layout in graphical view, I keep getting this error:
ClassCastException: com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup
Here is my preferences.xml:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="General">
<CheckBoxPreference android:title="Show default categories"
android:defaultValue="true" android:key="default_categories" />
</PreferenceCategory>
<PreferenceCategory android:title="Export">
<EditTextPreference android:key="default_emailaddress"
android:defaultValue="@string/pref_export_defaultemail"
android:title="Email Address" android:summary="@string/pref_export_emailsummary" />
<EditTextPreference android:key="filename_prefix"
android:defaultValue="@string/pref_export_defaultfilename"
android:title="Filename Prefix" android:summary="@string/pref_export_filenamesummary" />
</PreferenceCategory>
</PreferenceScreen>
I cannot for the life of me figure out what its talking about, my searches with google have not come up with anything substantial.
Change your editing configuration to Android 3.0(if you're using 2.3.3 and below).
Close Your Eclipse and Restart it Again...Usually Disappears
I had this issue. I changed the theme from "Project theme" to "Theme.Holo.Light.DarkActionBar" (my preferred theme) and it finally worked.
精彩评论