Reputation: 389
Create xml file and get an error
Exception raised during rendering: com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup Exception details are logged in Window > Show View > Error Log The following classes could not be found:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/buttonlayout" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:height="32dp" android:gravity="left|top" android:background="#2B60DE" android:paddingtop="2dp" android:paddingbottom="2dp">
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/buttonlayout2" android:orientation="horizontal" android:layout_height="wrap_content" android:gravity="left|center_vertical" android:layout_gravity="left" android:layout_width="wrap_content">
<textview android:id="@+id/txtTest" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textstyle="bold" android:textcolor="#FFFFFF" android:text="@string/app_header" android:textsize="15sp" android:gravity="center_vertical" android:paddingleft="5dp">
</textview></linearlayout>
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/buttonlayout2" android:orientation="horizontal" android:layout_height="wrap_content" android:gravity="right" android:layout_gravity="right" android:layout_width="fill_parent">
</linearlayout>
</linearlayout>
<tablelayout android:id="@+id/TableLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchcolumns="*">
<tablerow android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingtop="50dp">
<button android:id="@+id/btnSimple" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ListView From DB" android:textsize="25sp" android:layout_marginleft="10px" android:layout_marginright="10px" android:layout_marginbottom="5px" android:layout_margintop="5px" android:height="50dp" android:width="50dp"></button>
</tablerow>
<tablerow android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingtop="50dp">
</tablerow>
</tablelayout>
how can I solve this problem?
Upvotes: 0
Views: 1296
Reputation: 20155
Yes because Tags are wrong
linearlayout
this should be LinearLayout
textview
this should be TextView
tablerow
this should be TableRow
tablelayout
this should be TableLayout
Try to learn about Android basics about layout
And also remove namespace for the second LinearLayout i.e remove this xmlns:android="http://schemas.android.com/apk/res/android"
for the child LinearLayout
Upvotes: 3