0

xml ファイルを作成してエラーを取得する

レンダリング中に例外が発生しました: com.android.layoutlib.bridge.MockView は android.view.ViewGroup にキャストできません 例外の詳細は [ウィンドウ] > [ビューの表示] > [エラー ログ] に記録されます 次のクラスが見つかりませんでした:

<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>

どうすればこの問題を解決できますか?

4

1 に答える 1

3

はい、タグが間違っているためです

linearlayoutこれはあるべきですLinearLayout

textview これはあるべきですTextView

tablerowこれはあるべきですTableRow

tablelayoutこれはあるべきですTableLayout

レイアウトに関するAndroidの基本について学んでみてください

また、2番目の LinearLayout の名前空間も削除します。つまりxmlns:android="http://schemas.android.com/apk/res/android"、子のこれを削除しますLinearLayout

于 2013-03-25T08:55:21.783 に答える