kelebro63
kelebro63

Reputation: 389

Error creating xml file in android

Error while creating Xml file.

Exception raised during rendering:-

android.widget.CheckBox cannot be cast to android.view.ViewGroup

xml code

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:orientation="horizontal" 
android:gravity="center_vertical">
<CheckBox 
    android:id="@+id/bcheck" 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:focusable="false">   
<TextView 
    android:id="@+id/txtTitle" 
    android:layout_width="wrap_content"
     android:gravity="left|center_vertical" 
     android:layout_height="?android:attr/listPreferredItemHeight" 
     android:text="Test" 
     android:focusable="false">  
</TextView>
<LinearLayout android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:gravity="right|center_vertical">
    <ImageButton android:id="@+id/ImageButton01" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:clickable="true" ></ImageButton>
</LinearLayout></CheckBox>

how can I solve this problem?

Upvotes: 0

Views: 147

Answers (1)

VINIL SATRASALA
VINIL SATRASALA

Reputation: 634

Try this it works:

   <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:gravity="center_vertical">
    <CheckBox 
        android:id="@+id/bcheck" 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content" 
        android:focusable="false"> 
    </CheckBox>  
    <TextView 
        android:id="@+id/txtTitle" 
        android:layout_width="wrap_content"
         android:gravity="left|center_vertical" 
         android:layout_height="?android:attr/listPreferredItemHeight" 
         android:text="Test" 
         android:focusable="false">  
    </TextView>
    <LinearLayout android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:orientation="horizontal" 
        android:gravity="right|center_vertical">
        <ImageButton android:id="@+id/ImageButton01" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:clickable="true" ></ImageButton>
    </LinearLayout>
</LinearLayout>

Upvotes: 1

Related Questions