简体   繁体   中英

Error on displaying the graphical layout for an android app: com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup

I get this error when I switch from XML to GraphicalLayout in Eclipse. This is my code:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".AddPeople" >

<fragment
    android:id="@+id/AddPeopleList"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <EditText
        android:id="@+id/AddPeople_Name"
        android:hint="@string/AddPeople_ETHintName" />

    <EditText
        android:id="@+id/AddPeople_Number"
        android:hint="@string/AddPeople_ETHintNumber" 
        android:inputType="phone" />
</fragment>

I've checked through for obvious errors, but haven't spotted any. This is inflated in the normal way in an activity, but I think that problem is in the code. Thanks for the help!!!

create another app and past this cod in main xml file then go to graphical layout tab. Select the LinearLayout in Outline window and copy it an past your original app Outline window

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM